instruction
stringlengths
2
259
⌀
input
stringlengths
0
442
⌀
output
stringlengths
1
1.9k
⌀
text
stringlengths
273
2.08k
⌀
Take an array of strings and a character and return an array containing only the strings containing the given character.
def filter_by_character(str_arr, char): filtered_arr = [] for string in str_arr: if char in string: filtered_arr.append(string) return filtered_arr
null
Summarize key facts about „Béla III of Hungary“ clearly and accurately.
**Béla III of Hungary** Béla III (, , ; 114823 April 1196) was King of Hungary and Croatia between 1172 and 1196. He was the second son of King Géza II and Géza's wife, Euphrosyne of Kiev. Around 1161, Géza granted Béla a duchy, which included Croatia, central Dalmatia and possibly Sirmium. In accordance with a peace ...
null
Kolik je 28 × 5?
28 × 5 = 140
null
Code an algorithm to find the closest pair of elements in a given array with respect to a given target number.
arr = [10, 22, 28, 29, 30, 40], target = 44
def closest_pair(arr, target): min_difference = 999999 min_pair = (-1, -1) # Iterate through all elements for i in range(len(arr)): # Loop through rest of elements for j in range(i + 1, len(arr)): diff = abs(arr[i] + arr[j] - target) # Check for maximum difference if diff < min_difference: min_difference = diff min_pai...
null
Answer this logic programming question: What is the transitive closure of the binary relation "less than" on the set of integers?
The transitive closure of the 'less than' relation on the set of integers is defined as: if (x,y) belongs to the set of integers, then for all n, x < n and n < y implies x < y.
null
Summarize key facts about „King Country Rugby Football Union“ clearly and accurately.
**King Country Rugby Football Union** The King Country Rugby Football Union is a constituent union in the New Zealand Rugby Union. It is located in the central North Island of New Zealand in an area known as the King Country. It was formed in 1922 when the South Auckland Rugby Union was split into three (the other two...
null
Debug the following code and explain why it gave an error.
def sum(a, b): try: return a + b except TypeError: return "inputs should be numbers" finally: print("This function has successfully executed") output = sum(1, '2')
The code gave an error because a TypeError was raised due to trying to add an integer and a string. The error can be resolved by adding type-checking in the code: def sum(a, b): try: if type(a) == int and type(b) == int: return a + b else: return "inputs should be numbers" except TypeError: return "inputs should be num...
null
null
null
null
Anderson Paak Anderson Paak, rodným jménem Brandon Paak Anderson, (* 8. února 1986) je americký rapper a zpěvák. Hudbu začal produkovat ze svého domova v době, kdy docházel na střední školu. Později hrál na bicí v kostele, kde potkal svou budoucí manželku. Jejich manželství se po několika letech rozpadlo a Anderson se...
Write a code to calculate the sum of the cubes of the numbers in the list.
[1,2,3,4,5]
""" Function to calculate the sum of the cubes of the numbers in the list """ def list_cube_sum(list): """ Calculate the sum of the cubes of the numbers in the list """ total = 0 for i in list: total += i**3 return total if __name__ == '__main__': print(list_cube_sum([1, 2, 3, 4, 5])) # prints 225
null
Spočítej: 13 + 14 = ?
13 + 14 = 27
null
Čau tam?
Ahoj! Jak ti můžu pomoct?
null
Stručně shrň článek o tématu „Kasárna Most“ a uveď hlavní fakta.
**Kasárna Most** Kasárna Most (též Mostecká kasárna) je název areálu bývalých kasáren v severozápadní části města Mostu v Ústeckém kraji. Obdélníkový areál je obklopen ulicemi Československé armády (z jihu), Jana Opletala (z východu), Jugoslávská (ze severu) a Partyzánská (ze západu). Kasárna byla postavena v letech 1...
null
Stručně shrň článek o tématu „Bucharský bublák“ a uveď hlavní fakta.
**Bucharský bublák** Bucharský bublák je velice staré plemeno holuba domácího pocházející z jihozápadní Asie. Náleží do plemenné skupiny bubláků, což jsou holubi, u kterých se vyvinul specifický hlasový projev, tzv. bublání. Vrkání je modifikováno do déletrvajícího zvuku připomínajícího vzdálené zurčení potoka, zvoněn...
null
null
null
null
Cell CANARY Cell CANARY (Cellular Analysis and Notification of Antigen Risks and Yields) is a recent technology that uses genetically engineered B cells to identify pathogens. Existing pathogen detection technologies include the Integrated Biological Detection System and the Joint Chemical Agent Detector. History In 2...
Suggest a way to create a loop of 3 elements in C#.
In C#, a loop of 3 elements can be created using a for loop. The general syntax is as follows: for (int i = 0; i < 3; i++) { // Code to execute }
null
null
null
null
Křivočarý pohyb Křivočarý (též obecný) pohyb je takový pohyb, při kterém je trajektorií obecná křivka. Charakteristiky pohybu Základními charakteristikami obecného pohybu jsou poloha tělesa, jeho rychlost a zrychlení v daném čase. Polohu tělesa lze určit pomocí polohového vektoru , který je v takovém případě spojitou ...
Output true if a given expression evaluates to true and false if it doesn't.
expression = "2 + 2 == 4"
""" Output true if a given expression evaluates to true and false if it doesn't """ expression = "2 + 2 == 4" def evaluate_expression(expression): return eval(expression) if __name__ == '__main__': print(evaluate_expression(expression))
null
null
null
null
Kingston, Prince Edward Island Kingston is a rural municipality in Prince Edward Island, Canada. It is located within Queens County to the west of Charlottetown. The community is mainly farms with a small residential area. Demographics In the 2021 Census of Population conducted by Statistics Canada, Kingston had a pop...
Summarize key facts about „Tapu River“ clearly and accurately.
**Tapu River** The Tapu River (Waipatukahu Stream prior to 1974) is a river of the Coromandel Peninsula in New Zealand's North Island. It flows west from the Coromandel Range, reaching the Firth of Thames at the settlement of Tapu, approximately halfway between Thames and Coromandel. Except for ammoniacal nitrogen, wa...
null
Stručně shrň článek o tématu „Ladislav Lis“ a uveď hlavní fakta.
**Ladislav Lis** Ladislav Lis (24. dubna 1926 Mlaka – 18. března 2000 Sosnová) byl český a československý politik, v 50. letech předseda ČSM, v roce 1968 funkcionář KSČ v Praze, za normalizace disident, signatář a v roce 1982 také mluvčí Charty 77, po sametové revoluci poslanec Sněmovny národů Federálního shromáždění ...
null
Co je latency? (stručně)
Latence je zpoždění — jak dlouho trvá, než přijde odpověď.
null
null
null
null
HD 102117 b HD 102117 b, formally named Leklsullun, is a planet that orbits the star HD 102117. The planet is a small gas giant a fifth the size of Jupiter. It orbits very close to its star, but not in a "torch orbit" like the famous 51 Pegasi b. It was one of the smallest extrasolar planets discovered as of 2006. In ...
Generate a correct c++ program to compute the YTM of a bond
#include <iostream> #include <cmath> using namespace std; // Function to calculate bond yield float calculateYTM(float faceValue, float price, int numInterestPayments, float couponRate, float MaturityPeriod) { float guess = 0.1, ytm = 0; float a, b; while (ytm != guess) { ytm = guess; a = price; // Calculating the bond...
null
Write an if statement that checks if an integer, num, is less than 10.
num = 7
if num < 10: print("num is less than 10")
null
null
null
null
Bankocetle Bankocetle ( Bancozettel) byly první papírové peníze používané na území Rakouské monarchie v letech 1762–1811. Historie Jednalo se o státovky, nikoli bankovky. V rakouské části Habsburské monarchie byly zavedeny na přelomu let 1761/1762 za vlády Marie Terezie. Z pověření vlády je emitovala Wiener Stadtbanco...
Stručně shrň článek o tématu „Zoologie“ a uveď hlavní fakta.
**Zoologie** Zoologie je přírodní věda spadající do okruhu biologických věd, zabývající se studiem organismů z říše živočichů (Animalia). Tradičně se zoologie zabývá také studiem prvoků (protozoologií), kteří v současnosti již ovšem nejsou považováni za živočichy. Název pochází z řečtiny: ζοον (zoon) = zvíře, živočich...
null
Kolik je 8 × 14?
8 × 14 = 112
null
Co je terminál?
Terminál je textové rozhraní pro spouštění příkazů v systému.
null
Summarize key facts about „Gas exchange“ clearly and accurately.
**Gas exchange** Gas exchange is the physical process by which gases move passively by diffusion across a surface. For example, this surface might be the air/water interface of a water body, the surface of a gas bubble in a liquid, a gas-permeable membrane, or a biological membrane that forms the boundary between an o...
null
How would you modify the following Java code to print the first 5 numbers of the Fibonacci sequence?
public class FibonacciPrinter { public static void printNumbers() { System.out.println("..."); } }
public class FibonacciPrinter { public static void printNumbers() { int n1=0, n2=1, n3, i, count=5; System.out.print(n1+" "+n2); for(i=2;i<count;++i) { n3=n1+n2; System.out.print(" "+n3); n1=n2; n2=n3; } } }
null
Create an SQL query that returns the names of all the people born in the year 1990.
SELECT name FROM People WHERE yearOfBirth = 1990
SELECT name FROM People WHERE yearOfBirth = 1990;
null
Stručně shrň článek o tématu „Lobau“ a uveď hlavní fakta.
**Lobau** Lobau je údolní niva nacházející se na levém břehu Dunaje východně od rakouského hlavního města Vídně. Území o rozloze 23 km² je administrativně rozděleno mezi vídeňský obvod Donaustadt a město Groß-Enzersdorf. Lobau je tvořeno lužním lesem a sítí vodních kanálů. Nejrozšířenějším stromem je dub letní, roste ...
null
Generate an object using JavaScript that contains the numbers from 1 to 10.
const myObject = { "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, "10": 10 };
null
Create an API endpoint that takes two inputs (phone number and name) and updates contact details in the database.
@app.route("/api/update_contact_details", methods=['PUT']) def update_contact_details(): # Get the inputs from the request body phone_number = request.json['phone_number'] name = request.json['name'] # Query the database db.execute("UPDATE contacts SET name = '{name}' WHERE phone = '{phone_number}'".format(name=name, p...
null
Summarize key facts about „Yoshiko Sakuma“ clearly and accurately.
**Yoshiko Sakuma** is a Japanese actress. Her son is actor Takehiro Hira. In 1957, Sakuma was scouted and signed her contract with Toei film company. Following year she made her film debut with Utsukushiki Shimai no Monogatari Modaeru Soshun. In 1970, she married actor Mikijirō Hira but divorced in 1984. Sakuma landed...
null
Summarize key facts about „Gabe Holmes“ clearly and accurately.
**Gabe Holmes** Gabrison Brig Holmes (born March 29, 1991) is an American football tight end who is currently a free agent. He was originally signed by the Oakland Raiders as an undrafted free agent in 2015. He played college football at Purdue. Professional career Oakland Raiders After going undrafted in the 2015 NFL...
null
Stručně shrň článek o tématu „Římskokatolická farnost Mladošovice“ a uveď hlavní fakta.
**Římskokatolická farnost Mladošovice** Římskokatolická farnost Mladošovice je územním společenstvím římských katolíků v rámci vikariátu České Budějovice - venkov českobudějovické diecéze. O farnosti Historie V roce 1367 je v Mladošovicích doložena plebánie. Ta později zanikla a do roku 1631 zde duchovní správu zajišť...
null
Construct a C++ program that checks whether a number is prime or not.
number = 17
#include <iostream> using namespace std; int main() { int n, i, c; n = 17; c = 0; for (i = 1; i <= n; i++) { if (n % i == 0) { c++; } } if (c == 2) { cout << n << " is a prime number" << endl; } else { cout << n << " is not a prime number" << endl; } return 0; }
null
Construct a sql query to select the names and age of all employees who have a salary greater than 45000
SELECT name, age FROM employee WHERE salary > 45000;
null
You're asked to generate a unique list from a given list of duplicate integers.
input_list = [1, 1, 2, 3, 3, 3, 4, 4, 5, 5]
result_list = list(set(input_list))
null
Stručně shrň článek o tématu „Saint-Fargeau (stanice metra v Paříži)“ a uveď hlavní fakta.
**Saint-Fargeau (stanice metra v Paříži)** Saint-Fargeau je nepřestupní stanice pařížského metra na lince 3bis ve 20. obvodu v Paříži. Nachází se na náměstí Place Saint-Fargeau. Historie Stanice byla otevřena 27. listopadu 1921 jako součást vedlejší větve linky 3 ze stanice Gambetta. Od 27. března 1971 je součástí lin...
null
Spočítej: 27 + 9 = ?
27 + 9 = 36
null
null
null
null
Josef Vrba Josef Vrba je bývalý český fotbalista, obránce a záložník. Fotbalová kariéra V československé lize hrál za SK Plzeň. Nastoupil ve 141 ligových utkáních. Gól v lize nedal. Ligová bilance Literatura JEŘÁBEK, Luboš: Český a československý fotbal: lexikon osobností a klubů 1906-2006, Praha, Grada 2007. Jindřich...
Write a SQL code to generate a new table called "Customers" by selecting all columns from the "Orders" table.
SELECT * INTO Customers FROM Orders;
null
null
null
null
Martin Nejedlý Martin Nejedlý (* 7. července 1966 Kunovice) je český podnikatel a politik, v letech 2010 až 2018 místopředseda Strany Práv Občanů (z toho mezi lety 2013 a 2014 první místopředseda). Byl spoluvlastníkem a jednatelem společnosti LUKOIL Aviation Czech. Sport Nejprve se prosadil jako volejbalista, v roce 1...
Design a program that automatically refactors a python code to improve readability and reduce complexity.
def myfunc(): x = 1 y = 5 return x + y
def myfunc(): x = 1 y = 5 return x + y
null
null
null
null
Světový pohár v běhu na lyžích 1988/1989 Světový pohár v běhu na lyžích 1988/89 byl osmým ročníkem Světového poháru v běhu na lyžích pod záštitou Mezinárodní lyžařské federace (FIS). Muži i ženy odjeli celkem 12 individuálních závodů a 4 štafety. Celkovými vítězi se stali Švéd Gunde Svan a Ruska Jelena Välbeová. Výsle...
Become an algorithm to check if a linked list is empty.
def is_list_empty(head): if head == None: return True else: return False
null
null
null
null
Farní sbor Českobratrské církve evangelické v Praze 5 – Radotín Farní sbor Českobratrské církve evangelické v Praze 5 - Radotín je sborem Českobratrské církve evangelické v Praze. Sbor spadá pod Pražský seniorát. Sbor byl ustaven jako samostatný roku 1941. Duchovním sboru je farář Petr Špirko, kurátorem sboru Václav M...
Kolik je 20 × 4?
20 × 4 = 80
null
Summarize key facts about „Fran (footballer, born 1969)“ clearly and accurately.
**Fran (footballer, born 1969)** Francisco Javier González Pérez (; born 14 July 1969), known as Fran, is a Spanish retired professional footballer. He spent his entire career with Deportivo, as a left midfielder with skill and field vision, helping the club win the first La Liga title in its history. Fran represented...
null
Kolik je 28 × 7?
28 × 7 = 196
null
Construct an SQL query to get the total sales of each customer.
TABLE customers { id INT, name VARCHAR(90) } TABLE orders { order_id INT customer_id INT total DEC(10,2) }
SELECT c.name, SUM(o.total) FROM customers c JOIN orders o ON c.id = o.customer_id GROUP BY c.name;
null
Stručně shrň článek o tématu „Oblastní hokejové soutěže 1958/1959“ a uveď hlavní fakta.
**Oblastní hokejové soutěže 1958/1959** Československé oblastní soutěže ledního hokeje 1958/1959 byla třetí nejvyšší hokejovou soutěží na území Československa. Systém soutěže Soutěž se byla rozdělena do 8 skupin po 6 účastnících. Ve skupinách se všechny kluby utkaly každý s každým (celkem 10 kol). Vítězové jednotlivýc...
null
Write a Python program to compare two dictionaries by key.
def compare_dicts_by_key(dic1, dic2): if len(dic1) != len(dic2): return False for key in dic1: if key not in dic2 or dic1[key] != dic2[key]: return False return True
null
Develop a function in C++ to find the roots of a quadratic equation ax^2 + bx + c = 0.
double findRoots(double a, double b, double c) { double result; if ((b*b - 4*a*c) < 0) { return INT_MIN; } else { result = (-b + sqrt(b*b - 4*a*c)) / (2*a); return result; } }
null
Spočítej 5×11
5 × 11 = 55
null
Summarize key facts about „Tukipo River“ clearly and accurately.
**Tukipo River** The Tukipo River is a river of the southwest Hawke's Bay region of New Zealand's North Island. It flows east from its origins in the Ruahine Range to reach the Tukituki River five kilometres west of Waipukurau See also List of rivers of New Zealand References Rivers of the Hawke's Bay Region
null
Create a CSS rule to make all h1 elements red in color.
h1 { color: red; }
null
Summarize key facts about „Molla Kola, Simorgh“ clearly and accurately.
**Molla Kola, Simorgh** Molla Kola (, also Romanized as Mollā Kolā and Mollā Kalā) is a village in Kiakola Rural District, in the Central District of Simorgh County, Mazandaran Province, Iran. At the 2006 census, its population was 829, in 206 families. References Populated places in Simorgh County
null
Stručně shrň článek o tématu „Vltava“ a uveď hlavní fakta.
**Vltava** Vltava () je s délkou 430,2 km nejdelší řekou na území Česka. Pramení na Šumavě, u obce Černý Kříž, soutokem Teplé Vltavy a Studené Vltavy. Protéká mimo jiné Českým Krumlovem, Českými Budějovicemi a Prahou a ústí zleva do Labe v Mělníku. Povodí Vltavy s přítoky Malší, Lužnicí, Otavou, Sázavou a Berounkou za...
null
Spočítej 10×6
10 × 6 = 60
null
Calculate the cosine similarity between the given two sentence vectors.
vec1 = [1,2,3,4,5] vec2 = [2,3,4,5,6]
def cosine_similarity(vec1, vec2): dot_product = np.dot(vec1, vec2) norm_vec1 = np.linalg.norm(vec1) norm_vec2 = np.linalg.norm(vec2) return dot_product / (norm_vec1 * norm_vec2)
null
null
null
null
Erzberg Erzberg je hora ve Štýrsku v Rakousku. Jedná se o významné naleziště železné rudy. Současná výška hory je 1 466 metrů nad mořem, před začátkem těžby to bylo 1 532 metrů nad mořem. Každoročně se v činném povrchovém dole a jeho blízkém okolí pořádá Erzbergrodeo – závod na terénních motocyklech v disciplíně endur...
Vysvětli terminál?
Terminál je textové rozhraní pro spouštění příkazů v systému.
null
Stručně shrň článek o tématu „Hungarian Ladies Open 2018“ a uveď hlavní fakta.
**Hungarian Ladies Open 2018** Hungarian Ladies Open 2018 byl tenisový turnaj pořádaný jako součást ženského okruhu WTA Tour, který se odehrával na dvorcích s tvrdým povrchem Rebound Ace v BOK Hall komplexu Sportovního a kongresového centra Syma. Probíhal mezi 19. až 25. únorem 2018 v maďarské metropoli Budapešti jako...
null
Summarize key facts about „1893 Liverpool West Derby by-election“ clearly and accurately.
**1893 Liverpool West Derby by-election** The 1893 Liverpool West Derby by-election was held on 10 January 1893 after the death of the incumbent Conservative MP William Henry Cross. It was retained by the Conservative candidate Walter Hume Long. References 1893 elections in the United Kingdom West Derby, 1893 1893 in ...
null
What is 21 - 3?
21 - 3 = 18
null
null
null
null
Chuang-pchu Chuang-pchu může být: Chuang-pchu (městský obvod v Šanghaji) – městský okres v Šanghaji v Čínské lidové republice Chuang-pchu-ťiang – řeka v Šanghaji v Čínské lidové republice Chuang-pchu (městský obvod v Kantonu) – městský obvod v Kantonu v Čínské lidové republice Vojenská akademie Čínské republiky – voje...
Co je API? (stručně)
API je rozhraní, přes které spolu programy komunikují — často přes HTTP a JSON.
null
Create an HTML table with a header row and two columns.
<table> <tr> <th>Column 1</th> <th>Column 2</th> </tr> </table>
null
Create a program to find out the most frequent letter in a sentence.
The quick brown fox jumps over the lazy dog.
def most_frequent_letter(sentence): freq_dict = {} for letter in sentence: if letter in freq_dict: freq_dict[letter] += 1 else: freq_dict[letter] = 1 most_freq_letter = max(freq_dict, key = freq_dict.get) return most_freq_letter
null
Summarize key facts about „Lucky Jayawardena“ clearly and accurately.
**Lucky Jayawardena** Lucky Dissanayake Jayawardana is a Sri Lankan politician who is a member of parliament United National Party for Kandy District and also the minister of city planning, water supply and higher education. Jayawardana started his political career from the first Provincial Council election held in 19...
null
Summarize key facts about „Dapuqiao station“ clearly and accurately.
**Dapuqiao station** Dapuqiao () is a station on Line 9 of the Shanghai Metro. The station came into operation on December 31, 2009. It is located beneath the Xuhui Sun Moon Light Center. External links Railway stations in China opened in 2009 Shanghai Metro stations in Huangpu District Line 9, Shanghai Metro
null
Edit this HTML code to highlight odd rows of this table.
<table> <tr> <th>Name</th> <th>Age</th> </tr> <tr> <td>John</td> <td>30</td> </tr> <tr> <td>Anna</td> <td>20</td> </tr> <tr> <td>Mark</td> <td>25</td> </tr> <tr> <td>Amy</td> <td>28</td> </tr> </table>
<table> <tr> <th>Name</th> <th>Age</th> </tr> <tr style="background-color: lightgrey;"> <td>John</td> <td>30</td> </tr> <tr> <td>Anna</td> <td>20</td> </tr> <tr style="background-color: lightgrey;"> <td>Mark</td> <td>25</td> </tr> <tr> <td>Amy</td> <td>28</td> </tr> </table>
null
Write code to calculate the cosine similarity between the two given sentences
Sentences: "this is a great day" and "this is a superb day"
from sklearn.metrics.pairwise import cosine_similarity sentence1 = "this is a great day" sentence2 = "this is a superb day" vector1 = sentence1.split() vector2 = sentence2.split() cos_sim = cosine_similarity([vector1], [vector2]) print(cos_sim[0][0])
null
null
null
null
Seijú Seijú (声優, seiyū či seiyuu) je japonský hlasový herec či dabér, který účinkuje v rádiových hrách, anime, počítačových hrách a/nebo dabuje zahraniční filmy. Termín seijú se většinou používá na domácí produkci anime a animovaný film tvořený v Japonsku. Seijú jsou v Japonsku velice populární například Megumi Hajaši...
Stručně shrň článek o tématu „Thórovo kladivo ze Skåne“ a uveď hlavní fakta.
**Thórovo kladivo ze Skåne** Thórovo kladivo ze Skåne je masivní, bohatě zdobený „pohanský“ amulet z 9. století, z období vikingů. Symbolizuje hromovou zbraň, jíž vládne mytický severský bůh Thór. Stříbrný přívěsek, nalezený ve švédské provincii Skåne roku 1877, má na průvlečíku zobrazené oči s výčnělkem nápadně se po...
null
Stručně shrň článek o tématu „Marek Brodský“ a uveď hlavní fakta.
**Marek Brodský** Marek Brodský (* 19. května 1959 Praha) je český hudebník, textař, výtvarník, publicista a herec, syn herce Vlastimila Brodského, též poloviční bratr herečky Terezy Brodské. V roce 1983 spoluzaložil hudební skupinu Nahoru po schodišti dolů band, jejímž vedoucím, bubeníkem a hlavním textařem byl až do...
null
Stručně shrň článek o tématu „Musée de la Publicité“ a uveď hlavní fakta.
**Musée de la Publicité** Musée de la Publicité (Muzeum reklamy) je muzeum v Paříži. Nachází se v 1. obvodu v ulici Rue de Rivoli v paláci Louvre. Muzeum se specializuje na všechny formy reklamy. Muzeum spravuje Union centrale des arts décoratifs (Ústřední unie dekorativního umění). Sbírky Muzeum shromažďuje plakáty, ...
null
Summarize key facts about „Svetlogorsk“ clearly and accurately.
**Svetlogorsk** Svetlogorsk may refer to: Svetlogorsk Urban Settlement, several municipal urban settlements in Russia Svetlogorsk, Russia, several inhabited localities in Russia Svietlahorsk (Svetlogorsk), a town in Belarus
null
Summarize key facts about „Jenštejn“ clearly and accurately.
**Jenštejn** Jenštejn () is a municipality and village in Prague-East District in the Central Bohemian Region of the Czech Republic. It has about 1,500 inhabitants. Administrative parts The village of Dehtáry is an administrative part of Jenštejn. Etymology The original name of the village and the local castle was Jen...
null
Create a pandas dataframe containing the following columns and their respective values:
A, B, C A= 12, 15, 20 B= 30, 25, 35 C= 40, 45, 50
df = pd.DataFrame({"A": [12,15,20], "B": [30,25,35], "C": [40,45,50]})
null
Proč tento kód padá? ```python x = 1 if x = 1: print('ok') ```
Použij porovnání `==`: `if x == 1: print('ok')`.
null
null
null
null
Brouhot Automobiles G. Brouhot & Cie byl francouzský výrobce automobilů a motorů. Historie firmy Charles Brouhot založil v poslední dekádě 19. století ve Vierzonu společnost vyrábějící zemědělské stroje a zařízení. V roce 1898 vznikla samostatná společnost Automobiles G. Brouhot & Cie, sídlící taktéž ve Vierzonu. Ta u...
Given two data sets, one containing the user id (user_id) and first name (firstname) and another data set containing user_id and last name (lastname), write a Python function to join the two sets and create a new data set with firstname, lastname and user_id.
user_id: [1,3,4,7] firstname: ["John", "Alice", "Madison", "Peter"] user_id: [1,2,3,6] lastname: ["Smith", "Jones", "Brown", "Miller"]
def join_sets(user_id1, firstname, user_id2, lastname): user_id = user_id1 + user_id2 names = firstname + lastname result = [] for id in user_id: firstname = [name for id, name in zip(user_id1, firstname) if id == id][0] lastname = [name for id, name in zip(user_id2, lastname) if id == id][0] result.append({"user_id": ...
null
Give an example of inheritance in Python
class Animal: def __init__(self, name): self.name = name def eat(self): print(f"{self.name} is eating") class Dog(Animal): def bark(self): print(f"{self.name} is barking") dog = Dog("Fido") dog.eat() dog.bark() # Output: # Fido is eating # Fido is barking
null
Given a binary tree, write a method to compute the maximum path sum.
10 / \ 2 10 / \ / \ 20 1 -25 6
public int maxPathSum(TreeNode root) { int result = Integer.MIN_VALUE; if (root == null) return result; Stack<TreeNode> stack = new Stack<>(); stack.push(root); while (!stack.isEmpty()) { TreeNode currentNode = stack.pop(); result = Math.max(result, maxPathSum(currentNode)); if (currentNode.left != null) { stack.push(c...
null
Given two arrays in Java, how would you merge them into one array?
int[] array1 = {1, 2, 3}; int[] array2 = {4, 5, 6};
int[] mergedArray = new int[array1.length + array2.length]; System.arraycopy(array1, 0, mergedArray, 0, array1.length); System.arraycopy(array2, 0, mergedArray, array1.length, array2.length);
null
PHP: funkce slugify($text) — malá písmena, mezery na pomlčky.
```php function slugify(string $text): string { $text = strtolower(trim($text)); $text = preg_replace('/[^a-z0-9]+/', '-', $text); return trim($text, '-'); } ```
null
Use the given SQL table named 'employess' to find the total number of employees with the gender 'Male'.
CREATE TABLE employees ( empid INTEGER, firstname VARCHAR(50) NOT NULL, lastname VARCHAR(50) NOT NULL, gender VARCHAR(6) NOT NULL );
SELECT COUNT(*) FROM employees WHERE gender = "Male";
null
null
null
null
Jaroslav Ježek Jaroslav Ježek (25. září 1906 Žižkov – 1. ledna 1942 New York) byl český hudební skladatel, dirigent, hudební improvizátor, dramaturg a klavírista. Byl autorem taneční, divadelní a filmové hudby, ale i vážné hudby. Hudební inspiraci nabral hlavně v jazzu. Mezi jeho nejznámější a zvlášť populární je jeho...
Create a React component to sort an array of strings.
arr = ["test", "data", "string"]
import React from 'react'; class SortComponent extends React.Component { constructor(props) { super(props); this.state = { strings: this.props.strings }; } // sorting function sort = (strings) => { return strings.sort(); } render() { let sortedStrings = this.sort(this.state.strings); return ( <div> <div>Sorted strings:...
null
Translate to that language (italsky): Good morning
Překlad do tohoto jazyka nezaručím. Anglicky: Good morning. Česky: Dobré ráno.
null
Make the following code more efficient
def remove_dups(mylist): newlist = [] for item in mylist: if not item in newlist: newlist.append(item) return newlist
def remove_dups(mylist): seen = set() newlist = [] for item in mylist: if item not in seen: seen.add(item) newlist.append(item) return newlist
null
Create a while loop to iterate over the elements in the given list
my_list = [1, 2, 3, 4]
i = 0 while i < len(my_list): print(my_list[i]) i += 1
null
Rewrite the following code in the form of list comprehension.
names = ["Max","John","Monica","Harry","Steve"] upper_names = [] for name in names: upper_names.append(name.upper())
upper_names = [name.upper() for name in names]
null
Summarize key facts about „FE-Schrift“ clearly and accurately.
**FE-Schrift** The or ('forgery-impeding typeface') is a sans serif typeface introduced for use on licence plates. Its monospaced letters and numbers are slightly disproportionate to prevent easy modification and to improve machine readability. It has been developed in Germany where it has been mandatory since Novembe...
null
Rewrite the following code using ternary operator.
num1 = 5 num2 = 10 if num1 < num2: print("num1 is smaller than num2") else: print("num1 is greater than or equal to num2")
num1 = 5 num2 = 10 print("num1 is smaller than num2") if (num1 < num2) else print("num1 is greater than or equal to num2")
null
Given two numbers, find their LCM.
a = 15 b = 10
30
null