text stringlengths 141 2.89k ⌀ | instruction stringlengths 19 1.5k ⌀ | input stringlengths 0 800 ⌀ | output stringlengths 1 2.5k ⌀ |
|---|---|---|---|
[DE Wikipedia] Julius Heinrich von Buggenhagen
Julius Heinrich von Buggenhagen (* 18. September 1768 in Papitz; † 18. November 1827 in Duisburg) war ein preußischer Kriegs- und Domänenrat und Landrat. Leben Julius Heinrich entstammte der adeligen Familie Buggenhagen und war der Sohn von Julius Ernst von Buggenhagen (1... | null | null | null |
null | Develop a Python script for encoding a message using the Caesar cipher. | message = "hello world"
shift = 3 | def caesar(message, shift):
encoded_message = ""
for char in message:
if char.isalpha():
num = ord(char)
num += shift
if char.isupper():
if num > ord('Z'):
num -= 26
elif num < ord('A'):
num += ... |
[CS Wikipedia] Miroslav Kráľ
Miroslav Kráľ (* 2. listopadu 1947 Topoľčany) je bývalý slovenský fotbalista, útočník a fotbalový trenér. Sportovní kariéra V československé lize hrál za ZVL Žilina, nastoupil ke 171 ligovým utkáním a dal 26 gólů. Reprezentoval Československo na Olympijských hrách 1968 v Mexiku. Ligová bil... | null | null | null |
null | Modify the given dictionary such that any keys that start with the letter 'b' are removed. | my_dict = { "ant": "animals", "ball": "toy", "cat": "pets" } | my_dict = { "ant": "animals", "cat": "pets" } |
null | Given a string, identify the count of each letter in the string. | String: "apple" | {'a': 1, 'p': 2, 'l': 1, 'e': 1} |
null | Sort a given list of strings into alphabetical order. | my_list = ["Python", "JavaScript", "Java", "C++"] | def sort_alphabetically(my_list):
return sorted(my_list)
print(sort_alphabetically(my_list)) # ['C++', 'Java', 'JavaScript', 'Python'] |
null | Change the code so that it swaps the contents of two variables in one line. | a = 5 b = 10 | a, b = b, a |
null | Create a Python class "Point" that has two instance variables x and y. | class Point: def __init__(self, x, y): self.x = x self.y = y | |
null | Create an automated trading algorithm in Python. | import datetime
import pandas as pd
def automated_strategy(data, window1, window2):
# Calculating SMA
short_rolling = data.rolling(window=window1).mean()
long_rolling = data.rolling(window=window2).mean()
# Creating signals
data['short_mavg'] = short_rolling
data['long_mavg'] = long_rolling
... | |
null | Write a Python program to make a dictionary that contains a number as a key, and its cube as the corresponding value. | def cube_dictionary(n): d = {} for i in range(1, n+1): d[i] = i**3 return d | |
null | Clean the given data in Python by replacing NaN and None with 0. | import pandas as pd data = [[1, 'John', None], [2, 'Jane', 18], [3, 'Rudy', NaN]] df = pd.DataFrame(data, columns = ['id', 'name', 'age']) | import pandas as pd data = [[1, 'John', None], [2, 'Jane', 18], [3, 'Rudy', NaN]] df = pd.DataFrame(data, columns = ['id', 'name', 'age']) df.fillna(0, inplace = True) |
null | Construct a pre-order traversal code to traverse a binary tree. | def preOrder(root): if root: print(root.data) preOrder(root.left) preOrder(root.right) | |
null | Generate a Python script to calculate the sum of the following equation: 8x^2 + 5y^2 + 6x - 4y. | def calculate_sum(x, y):
'''This function calculates the sum of the following equation: 8x^2 + 5y^2 + 6x - 4y.'''
return 8*x**2 + 5*y**2 + 6*x - 4*y
# Call the function
result = calculate_sum(2, 3)
# Print the result
print("The sum is", result) | |
null | Design an algorithm to search for a particular node in a binary tree using breadth-first search. | def breadthFirstSearch(root, target): if root is None: return False queue = [root] while len(queue) > 0: node = queue.pop(0) if node.val == target: return True if node.left is not None: queue.append(node.left) if node.right is not None: queue.append(node.right) return False | |
null | Design a class that stores the data of an individual employee | class Employee: def __init__(self, name, age, salary): self.name = name self.age = age self.salary = salary def get_name(self): return self.name def get_age(self): return self.age def get_salary(self): return self.salary | |
null | Create a Python function to extract the largest prime factor from a given number. | number = 35 | def largest_prime_factor(number):
largest_factor = 1
for i in range(2, number+1):
while number % i == 0:
largest_factor = i
number //= i
return largest_factor
largest_prime_factor(35) # Output: 5 |
[DE Wikipedia] Möttlingen
Möttlingen ist ein Ortsteil der Stadt Bad Liebenzell im Landkreis Calw in Baden-Württemberg. Die Gemeinde trägt das Prädikat Erholungsort. Geographie Geographische Lage Möttlingen liegt 40 km westlich von Stuttgart und 15 km südsüdwestlich von Pforzheim im Heckengäu, einer Landschaft zwischen... | null | null | null |
null | Write a function to multiply two numbers in Java. | 5, 8 | public static int multiply(int x, int y){ return x * y; } System.out.println(multiply(5, 8)); |
null | Read the given CSS selector and explain what it does. | The given CSS selector "div > p:not(.special)" will select all the <p> elements that are children of <div> which do not have a class of "special". | |
null | Create a bubble sort algorithm in Python. | def bubble_sort(nums):
# Repeat until the array is sorted
sorted_array = False
while not sorted_array:
sorted_array = True
for i in range(len(nums) - 1):
if nums[i] > nums[i + 1]:
# If the next element is greater, swap them
nums[i], nums[i + 1] = n... | |
[HI Wikipedia] केम्पटी जलप्रपात
केम्प्टी जलप्रपात (अंग्रेजी: Kempty Falls), एक शानदार और मनमोहक जलप्रपात है जो भारत के राज्य उत्तराखण्ड के शहर मसूरी से 15 किमी की दूरी पर चकराता सड़क पर स्थित है और इस क्षेत्र का सबसे बड़ा आकर्षण है। यह जलप्रपात समुद्र तल से 1364 मीटर की ऊंचाई 78°-02’ पूर्व देशांतर और 30° -29’ उत्तर अक... | null | null | null |
null | Write a Python program to classify a given set of features as convex or non-convex. | [(1,0), (2,3), (3,1), (4,3)] | def classify_features(features):
#number of edges
edges = len(features)
polygon_corners = 0
convex_count = 0
non_convex_count = 0
# iterate through the list to check if the polygon is convex or non-convex
for i in range(edges):
polygon_corners += 1
next_i = i+1
if nex... |
[HI Wikipedia] पारसी धर्म
पारसी पंथ अथवा ज़ोरोएस्ट्रिनिज़म फ़ारस का राजपंथ हुआ करता था। यह ज़न्द अवेस्ता नाम के ग्रन्थ पर आधारित है। इसके संस्थापक ज़रथुष्ट्र हैं, इसलिये इसे ज़रथुष्ट्री पंथ भी कहते हैं। जोरोएस्ट्रिनिइजम दुनिया के सबसे पुराने एकेश्वरवादी धर्मों में से एक है। दूसरी सहस्राब्दी ईसा पूर्व की संभावित जड़ों ... | null | null | null |
null | Generate a program to convert a date in the format 'dd/mm/yyyy' to a date in the format 'yyyy/mm/dd'. | 02/12/2020 | def convert_date(date): date_list = date.split('/') return '{}/{}/{}'.format(date_list[2],date_list[1],date_list[0]) |
[CS Wikipedia] Zemské volby v Čechách 1895
Zemské volby v Čechách 1895 byly volby konané v Českém království od 20. do 26. listopadu 1895, kterými byli zvoleni poslanci Českého zemského sněmu coby zákonodárného sboru zemské samosprávy v rámci rakousko-uherského, respektive předlitavského ústavního systému. Probíhaly p... | null | null | null |
null | Construct a bubblesort algorithm in Python. | def bubbleSort(array): n = len(array) for i in range (n): for j in range(0, n-i-1): if array[j] > array[j+1] : array[j], array[j+1] = array[j+1], array[j] arr = [64, 34, 25, 12, 22, 11, 90] bubbleSort(arr) print ("Sorted array is:") for i in range(n): print ("%d" %arr[i]), | |
[EN Wikipedia] 2019–20 NBL Canada season
The 2019–20 NBL Canada season was the ninth season of the National Basketball League of Canada. The regular season was supposed to run from December 26, 2019, to April 23, 2020. However, on March 12, the season was suspended due to the COVID-19 pandemic in Canada. On April 1, t... | null | null | null |
null | Write a function that takes a 2D array as input and returns the transposed array | [[1, 2], [3, 4], [5, 6]] | def transpose(arr): new_arr = [] for i in range(len(arr[0])): new_arr.append([row[i] for row in arr]) return new_arr |
null | Create a variable that stores the result of the following function: 10 * 10 + 12 / 3. | int result = 44; | |
null | Write a Python function to generate a random string of length 10. | import random
import string
def generate_string():
chars = string.ascii_uppercase + string.ascii_lowercase + string.digits
random_string = ''.join(random.choice(chars) for i in range(10))
return random_string
# Example test
random_string = generate_string()
print(random_string) # 5BZFz5S2Sd | |
[HI Wikipedia] चित्रकला
चित्रकला एक द्विविमीय (two-dimensional) कला है। भारत में चित्रकला का एक प्राचीन स्रोत विष्णुधर्मोत्तर पुराण है। इतिहास चित्रकला का प्रचार चीन, मिस्र, भारत आदि देशों में अत्यंत प्राचीन काल से है। मिस्र से ही चित्रकला यूनान में गई, जहाँ उसने बहुत उन्नति की। ईसा से १४०० वर्ष पहले मिस्र देश में चित... | null | null | null |
null | Create a function in python that takes a string as an argument and prints out two copies of the string. | string = "Hello World!" | def print_twice(string): print(string) print(string) print_twice(string) |
null | Generate a Python program that takes as its inputs two lists of numbers and returns the sum of the elements in mutually overlapping positions. | two lists [1, 2, 3] and [4, 5, 6] | def sum_overlap(list1, list2):
result = 0
# Loop through the lists and add overlapping elements
for i in range(len(list1)):
if i < len(list2):
result += list1[i] + list2[i]
# Return result
return result
list1 = [1, 2, 3]
list2 = [4, 5, 6]
result = sum_overlap(list1, list2)
print(result) # Prints 12 |
[HI Wikipedia] हिरोडोटस
हिरोडोटस (ग्रीक: Ἡρόδοτος Ἁλικαρνᾱσσεύς Hērodotos Halikarnāsseus) (मृत्यु ४२५ ई.पू), यूनान के इतिहासकार एवं भूगोलवेत्ता थे। उन्होंने अपने इतिहास का विषय पेलोपोनेसियन युद्ध को बनाया था। उनके द्वारा लिखित पुस्तक हिस्टोरिका थी। भूगोलवेत्ता यूनानी भूगोलवेत्ता | null | null | null |
null | Create a class in Java that encapsulates a student's name and grade point average (GPA). | public class Student { private String name; private double gpa; public Student(String name, double gpa) { this.name = name; this.gpa = gpa; } public String getName() { return name; } public double getGPA() { return gpa; } } | |
null | Identify the bug in the following python code: def foo(x): x[0] = 2 | [0, 1, 2] | This code is trying to modify an immutable object (a tuple) as it is attempting to assign a value to the first element in a tuple. The correct way to do this is with a list, not a tuple. The code should be changed to: def foo(x): x[0] = 2 where the input x is a list instead of a tuple. |
[EN Wikipedia] Dicephalarcha herbosa
Dicephalarcha herbosa is a moth of the family Tortricidae. It is found in Thailand, India, southern Sulawesi, Java, Borneo, Bali and the Moluccas. The wingspan 10–13 mm. The forewings are dark fuscous on the costal half, while the lower half of the wing is pale bluish grey. The hin... | null | null | null |
null | Write a Python function to split a given string into equal parts in a loop. | string = "Hello World" | def split_string(string):
result = []
for i in range(0, len(string), int(len(string) / 2)):
result.append(string[i: i + int(len(string) / 2)])
return result |
null | Use an if statement to determine if a number is negative or positive. | number = -5 | if number < 0: print("The number is negative.") else: print("The number is positive.") |
null | Write a Python function that prints the square of a given number. | def square(num): return num ** 2 | |
null | Insert a record into a database table named ‘customers’ with the following values. | ID: 123 Name: John Doe Age: 35 | INSERT INTO customers (ID, Name, Age) VALUES (123, 'John Doe', 35); |
null | Sort a given array in ascending order based on the second element of each array element pair. | arr = [(3, 5), (4, 1), (1, 4), (2, 2)] | arr = [(3, 5), (4, 1), (1, 4), (2, 2)] # sort the array based on the second element in each pair arr.sort(key=lambda x: x[1]) print("The array sorted in ascending order based on the second element of each array element pair is:", arr) |
null | Create an Angular component to display an "about us" page. | @Component({ selector: "app-about-us", templateUrl: "./about-us.component.html" }) export class AboutUsComponent{ } | |
null | Explain the purpose of the %i in a Python format string. | The %i in Python is a special format specifier used to format integer numbers. When used in a format string, it will convert the number to an integer and insert it into the output string. This can be used to easily format numbers when printing output. | |
null | Write a Python script to compress a directory using the gzip library. | source directory: example_dir | import gzip
import os
# Walk through the source directory
for root, dirs, files in os.walk('example_dir'):
# Gzip each file
for file in files:
with open(os.path.join(root, file), 'rb') as f_in:
with gzip.open(os.path.join(root, file + '.gz'), 'wb') as f_out:
f_out.writelines... |
null | Create a React component for a form with three text boxes. | import React, { useState } from 'react'; const MyForm = () => { const [text1, setText1] = useState(''); const [text2, setText2] = useState(''); const [text3, setText3] = useState(''); return ( <form> <input type="text" value={text1} onChange={e => setText1(e.target.value)} /> <input type="text" value={text2} onChange={... | |
null | Create a python program that applies mean normalization to the given data. | [1, 2, 3, 4, 5, 6] | def normalize_mean(data):
mean = np.mean(data)
normalized = [x - mean for x in data]
return normalized |
null | Write HTML code for a text input field with the placeholder "Enter name". | <input type="text" placeholder="Enter name"> | |
null | Write code to find the intersection of two sorted lists | list1 = [1, 3, 4, 6] list2 = [1, 2, 5, 6] | def find_intersection(list1, list2): """ Find the intersection of two sorted lists :param list1: the first sorted list :param list2: the second sorted list :return: a list with elements found in both lists """ intersection = [] p1 = p2 = 0 while p1 < len(list1) and p2 < len(list2): if list1[p1] == list2[p2]: intersecti... |
[EN Wikipedia] Vicentinho Alves
Vicentinho Alves (born October 1, 1957) is a Brazilian politician. He has represented Tocantins in the Federal Senate since 2011. Previously he was a deputy from Tocantins from 2007 to 2011. He is a member of the Liberal Party (PL). References Living people 1957 births Members of the Fe... | null | null | null |
[DE Wikipedia] Olympische Sommerspiele 2020/Hockey/Qualifikation
Für die olympischen Hockeyturniere 2020 konnten sich bei sowohl bei den Männern als auch bei den Frauen 12 Mannschaften qualifizieren. Jede Mannschaft darf maximal 16 Spieler stellen. Herren Übersicht Asienspiele 2018 Der asiatische Vertreter wurde im Ra... | null | null | null |
null | Write a function which will print out a given pattern. | * ** *** **** | def print_pattern(n): for i in range(1, n+1): print("*" * i) print_pattern(4) |
null | Write a Python program to loop through a list and print each element of the list. | [1, 2, 3, 4] | for x in [1, 2, 3, 4]:
print(x) |
null | Create a function in Python to calculate the length of the longest palindrome in a given string. | String: abbaacba | def longest_palindrome(text):
n = len(text)
result = 0
dp = [[False] * (n + 1) for _ in range(n + 1)]
for l in range(1, n + 1):
for i in range(n - l + 1):
j = i + l - 1
if l == 1:
dp[i][j] = True
elif l == 2 and text[i] == text[j]:
... |
null | Write a loop to print the numbers from 10 to 1 in reverse order. | for i in range(10, 0, -1): print(i) | |
null | Create a Python function to encrypt a string using the substitution method. | def encrypt_substitution(s):
result = ''
for c in s:
result += chr(ord(c) + 3)
return result | |
null | Analyze the sentiment of the sentence "I am so delighted". | Positive sentiment. | |
null | Write a C program to print the numbers from 1 to 100, with the following conditions: if the number is divisible by 2, print "fizz" if the number is divisible by 3, print "buzz" if the number is divisible by both 2 and 3, print "fizzbuzz" | #include <stdio.h> int main(void) { int i; for (i=1; i<=100; i++) { // number divisible by 3 and 5 both if (i % 3 == 0 && i % 5 == 0) printf("fizzbuzz\n"); // number divisible by 3 only else if (i % 3 == 0) printf("fizz\n"); // number divisible by 5 only else if (i % 5 == 0) printf("buzz\n"); // number indivisible by b... | |
[CS Wikipedia] John Lewis Partnership
Společnost John Lewis Partnership je společnost družstevního typu, vzniklá v roce 1864 a vlastněná britskými zaměstnanci. Provozuje obchodní domy John Lewis, samoobslužné supermarkety Waitrose a několik dalších služeb. Charakteristika Společnost vlastní holdingem zastupujícím všec... | null | null | null |
[HI Wikipedia] बोत्सवाना
बोत्सवाना गणराज्य (अंग्रेजी: Republic of Botswana, श्वाना: Lefatshe la Botswana), अफ्रीकी महाद्वीप के दक्षिण में स्थित एक स्थल-रुद्ध देश है। 30 सितम्बर 1960 को ब्रिटेन की यूनाइटेड किंगडम से स्वतंत्रता मिलने से पूर्व इसे ब्रिटिश संरक्षित राज्य, बेचुआनालैंड के नाम से जाना जाता था। स्वतंत्रता प्र... | null | null | null |
null | Write a function to generate the Cartesian product of 2 sets in Python. | A = {1, 2}; B = {'a', 'b'} | from itertools import product def get_cartesian_product(A, B): return set(product(A, B)) A = {1, 2}; B = {'a', 'b'} print(get_cartesian_product(A,B)) |
[HI Wikipedia] आप्रवास
आप्रवास (अंग्रेज़ी: इम्मिग्रेशन)लोगों का उन क्षेत्रों में गमन होने को कहते हैं, जहां के वे मूल निवासी नहीं होते हैं। यह गमन वहां बसने की मंशा से किया जाता है।[1] आप्रवास कई कारणों से किया जा सकता है जिनमें मौसम, तापमान, प्रजनन, आर्थिक, राजनीतिक, परिवार के पुनःएकीकरण, प्राकृतिक आपदा, गरीबी या अपन... | null | null | null |
null | Create a MySQL query for finding customers who paid more than $100. | payment | SELECT customer.* FROM customer JOIN payment ON customer.ID = payment.customer_id WHERE payment.amount > 100; |
[DE Wikipedia] Bernardino della Chiesa
Bernardino della Chiesa OFMRef (; * 8. Mai 1644 in der Republik Venedig als Antonius della Chiesa; † 21. Dezember 1721 in Linqing, Shandong, Kaiserreich China) war ein italienischer Geistlicher, Missionar in China und Bischof von Peking. Leben Della Chiesa legte am 16. August 166... | null | null | null |
[DE Wikipedia] Amy Jo Johnson
Amy Jo Johnson (* 6. Oktober 1970 in Cape Cod, Massachusetts) ist eine US-amerikanisch-kanadische Schauspielerin und Musikerin. Leben und Karriere Amy Jo Johnson zog nach dem Abschluss der High School nach New York City, wo sie an der American Musical Dramatic Academy studierte. Zwei Jahr... | null | null | null |
null | Edit the given Python code to make it work for a list of dictionaries. | list_data = [{'id': 1, 'name': 'Tom'}, {'id': 2, 'name': 'Bob'}]
for element in list_data:
print(element) | list_data = [{'id': 1, 'name': 'Tom'}, {'id': 2, 'name': 'Bob'}]
for element in list_data:
print(element['name']) |
[EN Wikipedia] Ivan Rudnytskyi
Ivan Rudnytskyi (; born 5 July 1991) is a Ukrainian former professional footballer. Career In 2016, he played for Neman Grodno. References External links 1991 births Living people Ukrainian men's footballers Ukrainian expatriate men's footballers Expatriate men's footballers in Belarus E... | null | null | null |
null | Write a Python script that uses recursion to calculate the Fibonacci sequence for a given number of terms. | 6 | def Fibonacci(n):
if n<0:
print("Incorrect input")
elif n==1:
return 0
elif n==2:
return 1
else:
return Fibonacci(n-1)+Fibonacci(n-2)
# Driver Program
n = 6
print(Fibonacci(n)) |
null | Create a python class object for the following data: | A customer has name, age, emailid and phone number as attributes. | class Customer:
def __init__(self, name, age, emailid, phone_number):
self.name = name
self.age = age
self.emailid = emailid
self.phone_number = phone_number |
null | Suggest a code for removing the first element from an array. | arr.splice(0, 1); | |
null | Generate a structured array from a given dictionary in Python. | dictionary = {
"name": "John",
"age": 24,
"nationality": "American"
} | import numpy as np
data = np.array(list(dictionary.values()),
dtype=[('name','U20'),('age','i4'),('nationality','U10')]
) |
null | Write a Python code for extracting numbers from a given text. | import re
def extract_numbers(input_string):
"""This function extracts numbers from a given textstring using regular expressions."""
# Compile the regular expression
pattern = re.compile(r'\d+')
# Find all numbers in the string
output_list = pattern.findall(input_string)
return o... | |
null | Add two numbers using Python. | Numbers: 5, 7 | def add_two_numbers(x, y): return x + y if __name__ == '__main__': print(add_two_numbers(5, 7)) |
null | Design a python script to build a tree from a list of parent-child relationships. | [ (1, 2), (1, 3), (2, 4), (2, 5), (4, 6), (4, 7) ] | # Python
class Node:
def __init__(self, data):
self.data = data
self.children = []
def buildTree(relationships):
tree = {}
for parent, child in relationships:
if parent not in tree:
tree[parent] = Node(parent)
parent_node = tree[parent]
if child not in tree:
tree[chi... |
null | Create a machine learning algorithm in Python for predicting stock prices using historical data. | Historical Stock Price Data for AAPL (Apple stock) from Jan 1, 2010 to Dec 31, 2020 | import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
# Read in the stock data
data = pd.read_csv('aapl_stock_data.csv')
# Create the features and labels datasets
X = data[['High', 'Low', 'Close', 'Volume']]
y = data['Adj Close']
# Create a linear regression model
reg = LinearRegre... |
null | Given a list of strings, create a function that returns a list of only the unique strings. | ["this", "is", "a", "list", "of", "strings", "this", "list", "has", "some", "duplicates"] | def unique_strings(string_list): return list(set(string_list)) |
null | Generate a function that takes an array of integers and rearranges the elements in a cyclical fashion, such that the element at index 0 comes last, the element at index 1 goes to the front, the element at index 2 is inserted after the element at the last index and so on. | arr = [1, 2, 3, 4, 5] | def rearrange_array(arr): output = [] for i in range(len(arr)): idx = (i + 1) % len(arr) output.append(arr[idx]) return output |
null | Generate a Python program to print out square numbers up to 10. | for i in range(1,11):
print(i**2) | |
null | Develop an AI chatbot program in Python. | import re
import random
# Define AI responses
responses = {
"Hi": ["Hello there!", "Howdy!", "Hi 👋"],
"How are you": ["I'm doing great!", "Doing well!", "Never better 🤩"],
"Bye": ["Goodbye!", "See you later!", "Bye bye"]
}
# AI function
def chatbot(user_query):
response = "Sorry, I don't understand 🤔... | |
null | Construct a function in Python that takes a list and returns the mean of the elements in the list. | [30, 10, 40, 20] | def mean(list): # Finding total of the list elements total = 0 for num in list: total += num # Calculate mean of the list mean = total / len(list) # Return the mean return mean |
null | Write a Python code to sort a dictionary based on the values. | def sort_dict_by_value(in_dict):
""" Function to sort a dictionary by it's values
"""
return {k: v for k, v in sorted(in_dict.items(), key=lambda item: item[1])} | |
null | Create a graphical user interface using Python to perform the following function | Take two inputs from the user: a name and an age | import tkinter # Create an instance of tkinter root = tkinter.Tk() # Create two lables and two input boxes name_label = tkinter.Label(root, text ='Name: ') age_label = tkinter.Label(root, text ='Age: ') name_entry = tkinter.Entry(root) age_entry = tkinter.Entry(root) # Place the labels,entry boxes in the desired layout... |
null | Generate a new class from the given prototype. | class Prototype { public String name; public int age; public String gender; public Prototype(String name, int age, String gender) { this.name = name; this.age = age; this.gender = gender; } } | class Person extends Prototype { public String address; public String phone; public Person(String name, int age, String gender, String address, String phone) { super(name, age, gender); this.address = address; this.phone = phone; } } |
[EN Wikipedia] Andrija Radović
Andrija Radović (; 1872–1947) was a Montenegrin and Yugoslav politician and statesmen, former Prime Minister and leader of the People's and then Democratic Party, fighter for parliamentary democracy and chief proponent of Montenegro's unification with Serbia. Youth Andrija Radović was bo... | null | null | null |
[DE Wikipedia] Theodor von Malortie
Theodor Georg Louis Emil von Malortie (* 1. März 1844 in Hannover; † 1930) war ein sächsischer Generalmajor, Wirklich Geheimer Rat und Oberhofmeister der Königin Carola von Sachsen. Leben Herkunft Theodor von Malortie war ein Mitglied des bereits seit dem ersten Drittel des 12. Jahr... | null | null | null |
null | Create a table in SQL to store details about 1000 employers. | CREATE TABLE employers ( id INTEGER PRIMARY KEY, name VARCHAR(100) UNIQUE NOT NULL, age INT NOT NULL, gender VARCHAR(50) NOT NULL, street_address VARCHAR(100) NOT NULL, city VARCHAR(100) NOT NULL, state VARCHAR(100) NOT NULL, zip_code INT NOT NULL, phone_number VARCHAR(25) UNIQUE NOT NULL ); | |
null | Write code in Java to sort an array of integers in ascending order. | [5, 2, 8, 10, 4, 9] | public static void sortAscending(int[] arr) { for(int i = 0; i < arr.length - 1; i++) { int min = i; for (int j = i + 1; j < arr.length; j++) { if (arr[j] < arr[min]) { min = j; } } int tmp = arr[i]; arr[i] = arr[min]; arr[min] = tmp; } } |
[HI Wikipedia] टीपू सुल्तान
इतिहास के पन्नों में टीपू सुल्तान के नाम पर भले ही विवाद चली आ रही है किन्तु टीपू सुल्तान का नाम मिटा पाना असम्भव है। 20 नवंबर 1750 में कर्नाटक के देवनाहल्ली में जन्मे टीपू का पूरा नाम सुल्तान फतेह अली खान शाहाब था। उनके पिता का नाम हैदर अली और माँ का फकरुन्निसाँ था। उनके पिता मैसूर साम्राज... | null | null | null |
null | Write a Python program to generate a Markov chain given a text input. | Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, `and what is the use of a book,' thought Alice `without pictures or conversation?' | import random
def generateMarkov(text):
words = text.split(' ')
markovChain = {}
for i in range(len(words) - 2):
current = words[i]
next = words[i + 1]
if current in markovChain:
if next in markovChain[current]:
markovChain[current][next] += 1
else:
markovChain[current][n... |
null | Design a linear search algorithm in Python that returns the index of an item in an array. | arr = [1,2,3,4,5] | def linear_search(arr, target):
"""
Searches through a given input array to find the index of a provided target number.
Returns -1 if the target number is not found.
"""
for i in range(len(arr)):
if arr[i] == target:
return i
return -1 |
null | Generate Python code to evaluate a mathematical expression containing parentheses, addition and subtraction operations and numbers from 0-9. | 2-(8-3) | def evaluate_expr(expr):
# Reverse the expression
expr = expr[::-1]
# Stack to store integer values.
values = []
# Stack to store operators.
ops = []
# Traverse the given expression.
i = 0
while i < len(expr):
# Current character is a whitespace, skip it.
if expr[i] == ' ':
i += 1... |
[HI Wikipedia] विश्व की मुद्राएँ
विश्व की कुछ प्रमुख मुद्राएँ निम्नलिखित हैं:- अफगानी - अफगानिस्तान बहत - थाईलैंड बलोबा - पनामा बिर्र - इथियोपिया बोलिविर - वेनेजुएला बोलिवियानो - बोलिविया चेदी - घाना कोलोन - कोस्टारीका, अल साल्वाडोर क्राउन - चेक गणराज्य, डेनमार्क एस्तोनिया, आइसलैंड, नार्वे, स्वीडन दलासी - जाम्बिया मेस... | null | null | null |
null | How would you create a content management system (CMS) in Python? | import flask
from flask import request, redirect, url_for, render_template
from functools import wraps
app = flask.Flask(__name__)
app.config["DEBUG"] = True
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if "username" not in flask.session:
return redirect(url_fo... | |
[DE Wikipedia] Reichsamt des Innern
Das Reichsamt des Innern (auch Reichsamt des Inneren) war ein oberstes Reichsamt im Deutschen Kaiserreich. Es hatte die Aufgaben eines Innenministeriums, wurde aber erst in der Weimarer Republik zum Reichsinnenministerium. Geschichte Auf Vorschlag des Reichskanzlers Otto von Bismarc... | null | null | null |
null | Create a Python program to make a copy of an array. | """
Create a Python program to make a copy of an array.
"""
def copy_array(arr):
return arr[:]
if __name__ == '__main__':
arr = [1,2,3,4,5]
print(copy_array(arr)) | |
null | Generate a random alphanumeric string of length 8 in Java. | String AlphaNumericString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789" + "abcdefghijklmnopqrstuvxyz"; StringBuilder sb = new StringBuilder(8); for (int i = 0; i < 8; i++) { int index = (int)(AlphaNumericString.length() * Math.random()); sb.append(AlphaNumericString .charAt(index)); } String string8Length = sb.toString... | |
null | Write a MySQL query to select the name of the customer and the total sales made by each customer in a given month. | customers_table = 'customers'; sales_table = 'sales'; month = '04'; year = '2021'; | SELECT customers.name, sum(sales.amount) as total_sales FROM customers INNER JOIN sales ON customers.customer_id = sales.customer_id WHERE MONTH(sales.date) = '04' AND YEAR(sales.date) = '2021' GROUP BY customers.name |
null | Create a program in Python that can generate a random password of 8 characters. | import random
import string
def generate_password():
password_length = 8
all_characters = string.ascii_letters + string.digits + string.punctuation
password = "".join(random.choice(all_characters) for i in range(password_length))
return password | |
null | Given a word, remove all the vowels from it in C. | void remove_vowels(char *s) { for (int i = 0; s[i] != '\0'; i++) { if (s[i] == 'a' || s[i] == 'A' || s[i] == 'e' || s[i] == 'E' || s[i] == 'i' || s[i] == 'I' || s[i] == 'o' || s[i] == 'O' || s[i] == 'u' || s[i] == 'U') { for (int j = i; s[j] != '\0'; ++j) { s[j] = s[j+1]; } } } } | |
null | Create a neural network model in Python to classify a large data set with five distinct classes. | # import libraries
import tensorflow as tf
from tensorflow.keras import models
from tensorflow.keras import layers
# define the model
model = models.Sequential()
model.add(layers.Dense(units=64, activation='relu', input_dim=5))
model.add(layers.Dense(units=32, activation='relu'))
model.add(layers.Dense(units=16, acti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.