text
stringlengths
141
2.89k
⌀
instruction
stringlengths
19
1.5k
⌀
input
stringlengths
0
800
⌀
output
stringlengths
1
2.5k
⌀
[DE Wikipedia] Tajemnica Statuetki Tajemnica Statuetki ist ein 1993 von Metropolis Software House für DOS-basierte Computer entwickeltes und veröffentlichtes Computerspiel des Adventure-Genres. Es war das erste Abenteuerspiel aus Polen. Seine Handlung dreht sich um den fiktiven Interpol-Agenten John Pollack, der versu...
null
null
null
null
Create a regular expression to match strings containing two consecutive symbols "#" followed by four alphabetic characters.
/\#[a-zA-Z]{4}/
[CS Wikipedia] Eugen Lanti Eugen Lanti (pseudonym Eugena Adama) (19. července 1879 – 1. ledna 1947) byl normandský učitel a v esperantu píšící spisovatel. Jeho sloh byl prostý, sarkastický, užívání přípon a předpon zredukoval na minimum dle zásady „sufiĉo kaj neceso“ (přípona jen jako nutnost). Založil svaz Sennacieca...
null
null
null
null
Perform a linear search to find if a key exists in an array using C.
int arr[] = {4, 3, 2, 10, 40}; int key = 40;
// Perform linear search int flag = 0; for (int i = 0; i < 5; i++) { if (arr[i] == key) { flag = 1; break; } } if (flag == 1) printf("Present"); else printf("Not Present");
null
Modify the Python program below to make it more efficient.
def foo(lst): minimum = lst[0] for n in lst: if minimum > n: minimum = n return minimum
def foo(lst): minimum = min(lst) return minimum
[HI Wikipedia] अर्जेण्टीना आर्जेंटीना दक्षिण अमेरिका में स्थित एक देश है। क्षेत्रफल एवं जनसंख्या की दृष्टि से दक्षिणी अमरीका का ब्राजील देश के बाद द्वितीय विशालतम देश है (क्षेत्रफल: २७,७६,६५६ वर्ग कि.मी.)। इसके उतत्र में ब्राजील पश्चिम में चिली तथा उत्तरपश्चिम में पराग्वे है। देश २२° द.अ. तथा ५५° द.अ. के मध्य ३७,७०० क...
null
null
null
null
Create a basic web-scrapper program in Python that downloads the entire HTML of a given website.
https://example.com
import requests response = requests.get("https://example.com") html = response.text
null
Modify the existing code to enable user input so the user can enter their own number and have the average of those two numbers returned.
def find_average(a, b): return (a + b) / 2
def find_average(): a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) return (a + b) / 2
[CS Wikipedia] Johana z Guînes Johana z Guînes ( Jeanne de Guînes,† 1331/1342 Guerville) byla hraběnka z Eu a Guînes. Život Narodila se jako jedna ze dvou dcer Balduina z Guînes a Johany, dcery Matouše z Montmorency. Byla provdána za Jana z Brienne. Roku 1294 zdědili hrabství Eu a o rok později se Janovi podařilo na f...
null
null
null
null
Generate a Python program that takes in a string of text and returns the count of each unique word in the string
This is a sample string
def count_words(string): word_counts = {} words = string.split() for word in words: if word in word_counts: word_counts[word] += 1 else: word_counts[word] = 1 return word_counts print(count_words("This is a sample string")) # Output {'This': 1, 'is': 1, 'a': 1, 'sample': 1, 'string': 1}
[EN Wikipedia] Fondation Napoléon The Fondation Napoléon is a foundation, which registered as a French non-profit organization (reconnue d'utilité publique) on November 12, 1987. Its mission is to encourage and support study and interest in the history of the First, and Second French Empires and to support the preserv...
null
null
null
null
Compose a Python script to convert a string to an all-uppercase string.
String: 'Experiment'
# converting the string to upper-case string = "Experiment" print("Old String:", string) string = string.upper() print("New String:", string)
null
Who is the author of the book "Alice in Wonderland"?
The author of the book "Alice in Wonderland" is Lewis Carroll.
[CS Wikipedia] Afélium Afélium, též aphelium, česky odsluní, je nejvzdálenější místo od Slunce (přesněji od ohniska dráhy), jímž prochází těleso, které se kolem Slunce pohybuje po elipse. V aféliu se pohybuje těleso nejmenší rychlostí na své dráze (viz 2. Keplerův zákon). Tělesa se mohou pohybovat i po drahách, podobn...
null
null
null
null
Given a list of strings, write a Python program to convert each of the strings to lowercase.
["My Heart Will Go On","We Are The Champions","Thriller","Welcome To The Jungle","Eye Of The Tiger","Money For Nothing","Billie Jean","Purple Rain","The Show Must Go On","Bohemian Rhapsody"]
new_list = [] for item in ["My Heart Will Go On","We Are The Champions","Thriller","Welcome To The Jungle","Eye Of The Tiger","Money For Nothing","Billie Jean","Purple Rain","The Show Must Go On","Bohemian Rhapsody"]: new_list.append(item.lower()) print(new_list)
null
Create a Python program to convert a list of numbers to a comma separated string. The program should take a list of integers as input and return a string with the elements of the list separated by a comma (',').
list_of_integers = [1, 2, 3, 4]
def list_to_string(list): return ','.join(str(x) for x in list) list_of_integers = [1, 2, 3, 4] print(list_to_string(list_of_integers)) // Outputs: 1,2,3,4
null
Refactor a Python function with a long code block, so that it has descriptive function names, is object-oriented, and more efficient.
def long_code_block(input_a, input_b): result = 0 for i in range(len(input_a)): for j in range(len(input_b)): if input_b[j] == input_a[i]: result = result + 1 return result
def count_matches(list_a, list_b): count = 0 for item_a in list_a: for item_b in list_b: if item_b == item_a: count += 1 return count
null
Design a Python script to print the first 10 even numbers.
for num in range(0, 20, 2): if num < 10: print(num, end=' ') # Output: 0 2 4 6 8
null
Write a SQL query to produce a list of customer names from the following table.
Table: customers | customer_id | name | | --------- | ----- | | 1 | Bill | | 2 | Jane | | 3 | John |
SELECT name FROM customers;
[EN Wikipedia] Aberdeenshire Aberdeenshire (; ) is one of the 32 council areas of Scotland. It takes its name from the County of Aberdeen, which has substantially different boundaries. The Aberdeenshire Council area includes all of the area of the historic counties of Aberdeenshire and Kincardineshire (except the area...
null
null
null
[DE Wikipedia] Sandy Wilson Sandy Wilson ist der Name folgender Personen: * Sandy Wilson (1922–2007), britischer Architekt, siehe Colin St. John Wilson Sandy Wilson (Komponist) (Alexander Galbraith Wilson; 1924–2014), britischer Musicalkomponist und -texter Sandy Wilson (Regisseurin) (Sandra Wilson; * 1947), kanadisch...
null
null
null
null
Create a class that contains two methods: one to generate a random number between a given range, and one to create a list of "n" random numbers.
n = 10, min = 0, max = 100
class RandomNumberList: def __init__(self): self.numbers = [] def generate_random(self, min, max): return random.randint(min, max) def create_list(self, n, min, max): # Generate a list of n random numbers between min and max self.numbers = [self.generate_random(min, max) for _ in range(n)] return self.numbers
[CS Wikipedia] Salon vín Salon vín – národní soutěž vín ČR je finální soutěží systému Národní soutěže vín. V rámci soutěže je každý rok vybráno nejlepší víno s titulem "Šampion", dále "Vítězové kategorií" a "Nejlepší kolekce". Sto nejlepších vín soutěže je oceněno prestižním titulem "Salon vín ČR". Na vlastní soutěž n...
null
null
null
[DE Wikipedia] Bill Schafhauser William „Bill“ Schafhauser (* 12. März 1962 in Saint Paul, Minnesota) ist ein ehemaliger schweizerisch-US-amerikanischer Eishockeyspieler, der von 1989 bis 1996 in der Nationalliga A für den EV Zug aktiv war. Karriere Schafhauser begann an der lokalen Hill-Murray High School mit dem Eis...
null
null
null
[EN Wikipedia] List of Israeli films of 1972 A list of films produced by the Israeli film industry in 1972. 1972 releases Unknown premiere date See also 1972 in Israel References External links Israeli films of 1972 at the Internet Movie Database Lists of 1972 films by country or language Film 1972
null
null
null
null
Modify a jQuery code to make an element translucent
$(document).ready(function(){ $("#targetElement").css("opacity", "0.5"); });
null
Create a class in Python with methods "add" and "find" to add a value to a dictionary and find the value in it, respectively.
class Dictionary: def __init__(self): self.data = {} def add(self, key, value): self.data[key] = value def find(self, key): if key in self.data: return self.data[key] return None
[DE Wikipedia] Spanischer Fingerhut Der Spanische Fingerhut (Digitalis obscura), auch Dunkler Fingerhut genannt, ist eine Pflanzenart aus der Gattung der Fingerhüte (Digitalis) in der Familie der Wegerichgewächse (Plantaginaceae). Die Pflanze ist in östlichen und südöstlichen Bergregionen Spaniens und im marokkanische...
null
null
null
[DE Wikipedia] Arvède Barine Arvède Barine, Pseudonym von Louise-Cécile Vincens, geb. Bouffé (* 17. November 1840 in Paris; † 14. November 1908 ebenda) war eine französische Historikerin, Biographin und Literaturkritikerin. Leben Arvède Barine war eine Enkelin des unter Napoleon Bonaparte nach Frankreich eingewanderte...
null
null
null
null
Write a MySQL query to count the number of students enrolled in a course called "Coding 101".
SELECT COUNT(*) FROM students WHERE course = 'Coding 101';
[DE Wikipedia] Nihat Şahin Nihat Şahin (* 15. September 1989 in Izmir) ist ein türkischer Fußballtorhüter. Karriere Şahin kam in Izmir zur Welt und zog im Kindesalter mit seiner Familie nach Antalya. Hier begann er mit dem Fußballspielen in der Jugendmannschaft von Kar İçecek Sarılar Spor und anschließend in den Jugen...
null
null
null
[EN Wikipedia] Sanders Corps of Cadets Center The Sam Houston Sanders Corps of Cadets Center is a museum on the campus of Texas A&M University in College Station, Texas, dedicated to the school's Corps of Cadets. Since its opening in 1992, the Center has become home to thousands of Aggie artifacts, the Metzger-Sanders...
null
null
null
null
What code is necessary to randomly shuffle a list in Python?
import random def shuffle(list): random.shuffle(list) return list
null
Design a function that takes a string of HTML tags in an input and removes the tags from the string
def strip_tags(s): tag = False out = "" for c in s: if c == "<": tag = True elif c == ">": tag = False elif not tag: out += c return out
null
Write a Python script that computes the sum of two given integers.
def sum_two_ints(a, b): return a + b
null
Create a Python function to remove duplicate elements from a given array.
array = [1, 2, 5, 2, 1, 9]
def remove_duplicates(array): result = set() for element in array: result.add(element) return list(result) result = remove_duplicates(array) print(result)
null
Design a class for representing student data in Python
class Student: def __init__(self, name, age): self.name = name self.age = age def get_name(self): return self.name def get_age(self): return self.age
null
Generate a code in Python that takes a string as input and removes duplicate characters from it
St = "DaSSmmoonnd"
st = "DaSSmmoonnd" st_list = list(st) st_set = set(st_list) st_nodupes = ''.join(st_set) print(st_nodupes)
[HI Wikipedia] फ़िल कोगन फ़िलिप जॉन "फ़िल" कोगन (जन्म: 31 मई 1967) न्यूज़ीलैंड की टेलिविज़न शक्सियत हैं, जिन्हें सबसे अधिक सीबीएस पर प्रसारित होने वाले अमेरिकी रिएलिटी टीवी कार्यक्रम द अमेज़िंग रेस के मेजबान के तौर पर जाना जाता है। शृंखला का सबसे पहले प्रसारण 2001 में हुआ था और फ़िल प्रथम प्रकरण से ही इसके साथ जुड़े ह...
null
null
null
null
Write a Python code to calculate the factorial of a given number using memoization.
def factorial_memoization(n): #Creating table to store result factorial_table = [1] * (n+1) # Calculating factorial and storing in # the table for i in range(1, n+1): factorial_table[i] = i * factorial_table[i - 1] return factorial_table[n] result = factorial_memoization(5) print(result)
null
Write a python code to check for a number being prime or not.
num = 11
# Initialize a boolean no_prime no_prime = False # Check all numbers lower than num for i in range(2, num): if num % i == 0: no_prime = True break # Print the appropriate output if no_prime: print(num, 'is not prime') else: print(num, 'is prime')
null
Create a REST API in Python with Flask for a restaurant menu. The API should have endpoints for creating, updating, and deleting menu items.
Not applicable
from flask import Flask, request, json from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow # init Flask app = Flask(__name__) # Database init app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db = SQLAlchemy(app) # Marsh...
null
Write a SQL statement to delete all records from a table called 'students' where the grade is below 3.
DELETE FROM students WHERE grade < 3;
null
Explain the purpose of the keyword ``this`` in Java.
In Java, the keyword "this" is used to refer to the current object. It can be used to access the values of instance variables and to call methods within the current object. It can also be used to pass the object itself as an argument to another method. "this" is used to differentiate instance variables from local varia...
[EN Wikipedia] Tutaki River The Tutaki River is a river of the Tasman Region of New Zealand's South Island. It flows north from its sources southwest of Lake Rotoroa to reach the Mangles River 10 kilometres east of Murchison. See also List of rivers of New Zealand To access the river you head north of the town Murchis...
null
null
null
null
Create a array of objects in JavaScript.
let arrayObjects = [ {name: 'Spike', age: 6}, {name: 'Spot', age: 4}, {name: 'Max', age: 2}, {name: 'Fluffy', age: 8} ];
[CS Wikipedia] Ellinikí Radiofonía Tileórasi Ellinikí Radiofonía Tileórasi (ERT) (, : Řecký rozhlas a televize, čili Řecká vysílací společnost) je řecká veřejnoprávní televize a rozhlas. V červnu 2013 vláda rozhodla, že kvůli korupci a finanční neefektivnosti přeruší společnost po skončení svého programu 11. června (t...
null
null
null
null
Write a for loop in Python to sum up the elements of an array.
[5, 9, 2]
arr = [5, 9, 2] total = 0 for num in arr: total+=num print(total) Output: 16
null
Align text cells in a table to the left,he right, and center.
# Python program to align text cells in a table to the left,he right, and center table = [('Name', 'Age', 'Gender'), ('John', '21', 'Male'), ('Doe', '25', 'Female')] for row in table: # Align text to the left left_aligned = "{:<10}{:<10}{:<10}".format(*row) # Align text to the r...
null
Convert the following SQL statement to a Pyspark Query.
SELECT employee_id, name, salary FROM employees WHERE salary > 50000
spark.sql("SELECT employee_id, name, salary FROM employees WHERE salary > 50000").show()
null
Write an SQL query to identify unique months and years that appear in a table.
Table: Appointments id | month | year
SELECT DISTINCT month, year FROM Appointments;
null
Develop a class in Python to perform various matrix operations like addition, subtraction, multiplication and transpose.
class Matrix: def __init__(self, m, n, lst): self.m = m self.n = n self.mat = [] c = 0 for i in range(self.m): a =[] for j in range(self.n): a.append(lst[c]) c += 1 ...
null
Create a python program to calculate Fibonacci sequence for a given number.
n = 8
def fibonacci(n): if n == 0: return 0 elif n == 1: return 1 else: return fibonacci(n-1) + fibonacci(n-2) if __name__ == '__main__': n = 8 print(fibonacci(n))
null
Create a Python class to work with complex numbers.
class ComplexNumber: """This class is used to work with complex numbers.""" def __init__(self, real, imag): self.real = real self.imag = imag def __add__(self, other): """This method overloads the '+' operator to add complex numbers.""" return ComplexNumber(self.real + other.real, self.imag + other.imag) def __sub__(se...
null
Create a machine learning model that predicts whether an email is spam or not.
import scikit-learn as sklearn # Load the data X = dataset[['email_body', 'send_from', 'subject', 'num_links']] y = dataset['is_spam'] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0, stratify=y) # Train the model classifier = sklearn.linear_model.LogisticRegression() classif...
null
Replace the placeholders in the following Python code snippet with appropriate values.
for x in range(__, __): print(x)
for x in range(0, 10): print(x)
null
Write a code to merge two given lists of equal size.
list1 = [1,2,3] list2 = [4,5,6]
""" Write a code to merge two given lists of equal size """ # Given lists list1 = [1,2,3] list2 = [4,5,6] # Initialising an empty list merged_list = [] # Merging the lists for i in range(len(list1)): merged_list.append(list1[i]) merged_list.append(list2[i]) # Printing the merged list print("Merged list is", merged_list...
null
Create a Python program to generate a list of random integers with the size
5
import random def generate_random_int_list(n): return [random.randint(0,10) for i in range(n)]
null
Using the standard library to construct a generator that returns the first n prime numbers.
from math import sqrt def prime_numbers(n): primes = [] i = 2 while len(primes) < n: for number in range(2, int(sqrt(i)) + 1): if i % number == 0: break else: primes.append(i) i += 1 yield from primes
[EN Wikipedia] Rawda, Kuwait Rawda ( Gulf Arabic pronunciation: ) is an area of Capital Governorate in Kuwait and a suburb of the capital city of Kuwait City. It comprises five blocks. The area is served by Rawda and Hawally Co-Op Society. It neighbours five other areas: Adialiya, Nizha, Hawally and Surra. The area fa...
null
null
null
null
Compose a Python function to find all the prime numbers between 1 and 100.
def find_primes(x, y): result = [] for num in range(x, y + 1): if num > 1: isPrime = True for i in range(2, num//2 + 1): if num % i == 0: isPrime = False break if isPrime: result.append(num) r...
null
Design a class to represent a Circle with a radius
class Circle { constructor(radius) { this.radius = radius; } getArea() { return Math.PI * this.radius * this.radius; } getCircumference() { return 2 * Math.PI * this.radius; } }
[EN Wikipedia] Grand Prix Bradlo The Grand Prix Bradlo was a cycling race held annually in Slovakia. It was part of UCI Europe Tour in category 2.2. Winners References Cycle races in Slovakia Recurring sporting events established in 2000 Recurring sporting events disestablished in 2009 2000 establishments in Slovakia ...
null
null
null
null
Edit the Java code to filter out the persons whose age is less than 18.
List<Person> persons = new ArrayList<>(); for (Person person : persons) { System.out.println(person.getName()); }
List<Person> persons = new ArrayList<>(); for (Person person : persons) { if (person.getAge() >= 18) { System.out.println(person.getName()); } }
[CS Wikipedia] Betlémská Betlémská ulice na Starém Městě v Praze spojuje Smetanovo nábřeží a Betlémské náměstí. Nazvána je podle nedaleké Betlémské kaple na Betlémském náměstí postavené v letech 1391-94. Na čísle 4 je nejstarší střední průmyslová škola v České republice, celým názvem Střední průmyslová škola strojnick...
null
null
null
null
Create a new Python class called Area to calculate the area of different shapes.
class Area: def __init__(self): pass def calculate_area_rectangle(self, length, width): return length * width def calculate_area_triangle(self, base, height): return 0.5 * base * height def calculate_area_circle(self, radius): return 3.14 * radius**2
null
How would you debug the following code?
def findNumberSum(numbers): total = 0 for n in numbers: total += n return total
To debug the code, you could start by adding print statements at different places in the code to find out the output at each step. For instance, you could add print statements to print out the value of the "total" variable at the beginning, during and after the for loop, or to see the contents of the list "numbers". Th...
null
Create an HTML page containing a text field and a button.
<!DOCTYPE html> <html> <head> <title>Input Form</title> </head> <body> <form> <input type="text" /> <input type="submit" value="Submit" /> </form> </body> </html>
null
Write a Python program for a program that checks if two strings are palindromes.
Input strings: “radar”, “dad”
def is_palindrome(str1, str2): # Reverse str1 reverse_str1 = str1[::-1] # Check if str1 is the same as the reversed version of str2 if reverse_str1 == str2: return True else: return False # Sample input str1 = 'radar' str2 = 'dad' # Check if the strings are palindromes print(is_palindrome(str1, str2)) # Outpu...
[DE Wikipedia] Friedrich Küter Friedrich Karl Ernst Küter (* 19. Mai 1879 in Stralau; † 31. Januar 1945 vermutlich in Bergen-Belsen) war ein deutscher Kaufmann und als Kommunalpolitiker 1920 der erste Bezirksverordnetenvorsteher von Berlin-Tempelhof. Lebenslauf Am 22. März 1902 heirateten Friedrich Küter und Emma Mari...
null
null
null
null
Construct the lambda function for calculating the square of a number.
square = lambda x: x*x #This lambda function will calculate the square of a number.
null
Edit the given Python code to compute the mean of the given list of numbers.
my_list = [10, 20, 30, 40, 50] sum = 0.0 for x in my_list: sum += x
my_list = [10, 20, 30, 40, 50] sum = 0.0 for x in my_list: sum += x mean = sum / len(my_list)
null
Write a Python function using the Pandas library to filter out the rows with a missing value in the specified column.
Dataframe: Name Age John 25 Jane Maria 30 Column Name: Age
import pandas as pd # Input Data df = pd.DataFrame({'Name': ['John','Jane','Maria'], 'Age': [25, None, 30]}) # Filter the Data filtered_df = df.loc[df['Age'].notnull()] print(filtered_df)
[HI Wikipedia] ओनेगा झील ओनेगा झील (रूसी: Оне́жское о́зеро, ओनेझ़स्कोए ओज़ेरो; अंग्रेज़ी: Lake Onega) पश्चिमोत्तरी रूस में कारेलिया गणतंत्र, लेनिनग्राद ओब्लास्त व वोलोग्दा ओब्लास्त के क्षेत्रों में स्थित एक मीठे पानी की झील है। लादोगा झील के बाद यह यूरोप की दूसरी सबसे बड़ी झील है। नाविक यातायात के लिये बाल्टिक सागर को...
null
null
null
null
Build a Python program to tokenize a string into separate words.
"Hello, World!"
def tokenize(string): words = string.split(" ") return words tokenized_str = tokenize("Hello, World!") print(tokenized_str)
[HI Wikipedia] पीयूष मिश्रा पीयूष मिश्रा (जन्म १३ जनवरी १९६३) एक भारतीय नाटक अभिनेता, संगीत निर्देशक, गायक, गीतकार, पटकथा लेखक हैं। मिश्रा का पालन-पोषण ग्वालियर में हुआ और १९८६ में उन्होंने दिल्ली स्थित नेशनल स्कूल ऑफ़ ड्रामा से स्नातक की शिक्षा प्राप्त की। उन्होंने मकबूल, गुलाल, गैंग्स ऑफ वासेपुर जैसी फ़िल्मों में गा...
null
null
null
null
Construct an SQL statement to select data from two tables.
SELECT table_1.*, table_2.* FROM table_1, table_2 WHERE table_1.column_name = table_2.column_name;
null
Create a Python program which keeps track of 3 variables x, y and z.
def keep_track(): x = 0 y = 0 z = 0 while True: # do something to x, y and z ...
null
Write a SQL query to find the names of all employees working at a given department
SELECT e.name FROM employee e JOIN department d ON e.departmentid = d.id WHERE d.name = 'given department'
null
Generate a code snippet to add two numbers in Python.
x = 2, y = 4
result = x + y print(result) # Prints 6
null
What is the fifth prime number?
The fifth prime number is 11.
null
Rewrite the following function from Java to Python: int findMax(int[] arr) { int max = arr[0]; for (int i = 0; i < arr.length; i ++) { if (arr[i] > max) { max = arr[i]; } } return max; }
Not applicable
def find_max(arr): max = arr[0] for i in range(len(arr)): if arr[i] > max: max = arr[i] return max
[DE Wikipedia] Umon (Volk) Die Umon sind eine Volksgruppe in Nigeria, die aus etwa 29.800 Menschen (Stand: 2013) besteht. Sie sprechen eine gleichnamige Sprache, die zur Sprachgruppe Kohumono-Ubaghara gehört. Die vorwiegende Religion ist das Christentum. Literatur Toyin Falola, Bukola Adeyemi Oyeniyi: Nigeria. ABC-Cli...
null
null
null
[CS Wikipedia] Agluona Název Agluona může znamenat: Agluona (Minija) – řeka na západě Litvy, levý přítok Minije Agluona (Šešuvis) – řeka (mající dvě stejnojmenné větve) na západě Litvy, pravý přítok řeky Šešuvis Agluona (Agluona) – jedna ze zmíněných větví (přítok stejnojmenné řeky Agluony) Agluona (Vadakstis) – řeka ...
null
null
null
null
Use CSS to create a box containing some text with a light green background, black text, and a white border.
.box { background-color: lightgreen; color: black; border: 1px solid white; }
null
Write a single-line Python code to delete a key-value pair from a dictionary.
my_dictionary = {'name': 'John', 'age': 20, 'job': 'Software Engineer', 'city': 'Berlin'}
my_dictionary.pop('city')
[CS Wikipedia] Dějiny lidstva Dějiny lidstva jsou oblast dějin, která se zabývá celou minulostí lidské kultury a společnosti. Jako vědecký obor jsou předmětem historických věd, ale i antropologie. Vzletně a přitom výstižně popsal smysl této disciplíny Marcus Tullius Cicero: „Historia vero testis temporum, lux veritati...
null
null
null
null
Write a Bash script to accept two command line arguments (username and password) and echo them out.
#!/bin/bash username=$1 password=$2 echo "Username: ${username}" echo "Password: ${password}"
[CS Wikipedia] Stevan Mirković Stevan Mirković (v srbské cyrilici Стеван Мирковић; 27. října 1927, Valjevo, Království Srbů, Chorvatů a Slovinců – 26. září 2015, Bělehrad) byl účastník jugoslávského partyzánského boje, voják Jugoslávské lidové armády. V roce 1944 vstoupil do řad partyzánů a také do komunistické strany...
null
null
null
null
Write an SQL query to find all employees with a salary greater than $5000.
SELECT * FROM employees WHERE salary > 5000;
null
Compute the Least Common Multiple of two numbers.
a = 15 b = 10
# Python3 code to find LCM def compute_lcm(x, y): # choose the greater number if x > y: greater = x else: greater = y while(True): if((greater % x == 0) and (greater % y == 0)): lcm = greater break greater += 1 return lcm lcm = compute_lcm(15, 10) prin...
null
Automatically refactor a subsection of Python code that uses two for-loops.
for x in range(3): for y in range(4): print(x, '-', y)
for x, y in itertools.product(range(3), range(4)): print(x, "-", y)
[EN Wikipedia] Elios Manzi Elios Manzi (born 28 March 1996) is an Italian judoka. He competed at the 2016 Summer Olympics in the men's 60 kg event, in which he was eliminated in the second round by Kim Won-jin. References External links 1996 births Living people Italian male judoka Olympic judoka for Italy Judoka at t...
null
null
null
null
Specify the platform and the environment variables needed to run a Java program.
The platform dependent environment variables needed to run a Java program on any platform are: 1. JAVA_HOME: This variable stores the location of JDK. 2. PATH: This variable stores the path to the executables. 3. CLASSPATH: This variable contains the path to the Java classes. 4. JRE_HOME: This variable stores the locat...
null
Write a function in Python that creates a random password of length 8 with at least two uppercase letters, one lowercase letter, one number, and one special character.
Not applicable
import random import string def random_password(): char_length = 8 characters = string.ascii_letters + string.digits + string.punctuation password = ''.join(random.choice(characters) for x in range(char_length)) has_uppercase = any(x.isupper() for x in password) has_lowercase = any(x.islower() for x in passw...
null
What is the code for using the Python Requests module to post data to the server?
URL: "http://example.com/data"
import requests url = "http://example.com/data" data = {"name":"John Doe","age":30} response = requests.post(url, data = data)
[EN Wikipedia] Moskovsky Rail Terminal Moskovsky Rail Terminal may refer to: Moskovsky Rail Terminal (Nizhny Novgorod), a rail terminal in Nizhny Novgorod, Russia Moskovsky Rail Terminal (Saint Petersburg), a rail terminal in St. Petersburg, Russia Moskovsky Rail Terminal (Tula) See also Moscow railway station (disamb...
null
null
null
null
Create a class in Python to generate a calendar.
calendarName = "My Calendar"
class CalendarGenerator(object): def __init__(self, name): self.name = name def generate_calendar(self): calendar = [] # Code to generate a calendar goes here return calendar calendar = CalendarGenerator(calendarName) calendar.generate_calendar()
null
What is the Python library used to parse a JSON string?
The Python library used to parse a JSON string is json. The json library provides functions for encoding and decoding a JSON string. The syntax for decoding would be: json.loads(data). The syntax for encoding would be: json.dumps(data).
null
Run a sentiment analysis of the following sentence using Python.
The food was really good but the service was terrible.
""" Run a sentiment analysis of the sentence using Python """ import nltk from textblob import TextBlob text = 'The food was really good but the service was terrible.' blob = TextBlob(text) for sentence in blob.sentences: print(sentence.sentiment) # Output Sentiment(polarity=0.05, subjectivity=0.6)