text stringlengths 141 2.89k ⌀ | instruction stringlengths 19 1.5k ⌀ | input stringlengths 0 800 ⌀ | output stringlengths 1 2.5k ⌀ |
|---|---|---|---|
[HI Wikipedia] बौद्ध धर्म
बौद्ध धर्म नेपाल की श्रावक परंपरा से निकला ज्ञान धर्म और दर्शन है। श्रावक ( संस्कृत ) या सावक ( पाली ) का अर्थ है "सुनने वाला" या, अधिक सामान्यतः, "शिष्य"। इस शब्द का प्रयोग बौद्ध धर्म और जैन धर्म में किया जाता है । ईसा पूर्व छठवीं शताब्दी में गौतम बुद्ध द्वारा बौद्ध धर्म का प्रवर्तन किया गया... | null | null | null |
null | Create an R function that plots a histogram of a given data set. | plot_histogram <- function(data) { hist(data, main = "Histogram of given data set") } | |
null | Build a package and deploy it in the cloud. | The package is an API to authenticate users and the API should be able to authenticate users having different types of API keys. | Create a package containing API authentication logic and all the necessary API keys. Set up a cloud service, such as AWS or GCP, and deploy the package. Configure the cloud service to accept incoming requests and authenticate the user using the API keys. |
[EN Wikipedia] Xie Hongjun
Xie Hongjun (; born 2 August 1929) is a former Chinese footballer. Club career As an 11-year-old, Xie Hongjun played for Shanghai Jiangnan Shipyard's football team. Throughout his career, Hongjun played for Shanghai Team, East Team, the Navy football team and Bayi. Xie was regarded as China'... | null | null | null |
null | Write a C++ program to find the kth smallest element in an unsorted array using minimum number of comparisons. | #include<algorithm> #include<math.h> using namespace std; int kthSmallest(int arr[], int n, int k) { sort(arr, arr + n); return arr[k - 1]; } // Function to find the kth smallest element int kthSmallestWComp(int arr[], int n, int k) { // Initialize values of left and right int left = -2147483648, right = 2147483647, an... | |
null | Write a Python class to represent a polynomial of degree n. | <no input> | class Polynomial:
def __init__(self, coeff):
self.coeff = coeff
def __call__(self, x):
result = 0
for idx, c in enumerate(self.coeff):
result += c * x ** idx
return result |
null | Create a Python program to print out the numbers in reverse order from 100 to 1. | for i in range (100,0,-1):
print(i) | |
null | Define an interface for a data import task in Python. | Not applicable | class DataImportTask:
def __init__(self, source, destination):
self.source = source
self.destination = destination
# Method to download the source file to the file system
def download(self):
# Implementation here
# Method to read the content of the source file into a CSV forma... |
[EN Wikipedia] Gmina Pniewy, Masovian Voivodeship
Gmina Pniewy is a rural gmina (administrative district) in Grójec County, Masovian Voivodeship, in east-central Poland. Its seat is the village of Pniewy, which lies approximately 10 kilometres (6 mi) north-west of Grójec and 40 km (25 mi) south-west of Warsaw. The gmi... | null | null | null |
null | Given a list of numbers, print the difference between the largest and the smallest number. | list_of_numbers = [10, 7, 5, 12, 4] | difference = max(list_of_numbers) - min(list_of_numbers) print(difference) |
null | Parse a given XML document and create a JavaScript object. | <?xml version="1.0"?> <catalog> <book id="bk101"> <author>Kerridge, Alan</author> <title>The Kitchen Diaries</title> <price>29.99</price> </book> <book id="bk102"> <author>Zinsser, William</author> <title>On Writing Well</title> <price>19.95</price> </book> </catalog> | const parser = new DOMParser(); const xmlDoc = parser.parseFromString(text, "text/xml"); const books = xmlDoc.querySelectorAll('book'); const result = {}; books.forEach(book => { const id = book.getAttribute('id'); result[id] = { author: book.querySelector('author').textContent, title: book.querySelector('title').textC... |
null | Print the numbers in a Fibonacci series with a loop. | # Fibonacci Series using a loop # the first two numbers of the Fibonacci series is 0 and 1 a = 0 b = 1 print(a) print(b) for i in range(10): c = a + b a = b b = c print(c) | |
null | Create a method called `combineName` that takes in two strings and combines them together into a full name. | firstName = 'John' lastName = 'Smith' | def combineName(firstName, lastName): """ A method that takes in two strings and combines them into a full name. Args: firstName (str): first name lastName (str): last name Returns: fullName (str): combined full name """ fullName = firstName + " " + lastName return fullName if __name__ == '__main__': firstName = 'John'... |
[HI Wikipedia] सुशील कोइराला
सुशील कोईराला नेपाल के प्रधानमंत्री रह चुके हैं। वे नेपाल के वरिष्ठ राजनीतिज्ञ तथा लोकतान्त्रिक योद्धा है तथा नेपाली कांग्रेस पार्टी के सभापति है। 10 फ़रवरी 2014 को राष्ट्रपति ने उन्हें प्रधानमंत्री पद की शपथ दिलाई। वे नेपाल के 37वें तथा वर्ष 2008 में राजशाही खत्म होने के बाद छठे प्रधानमंत... | null | null | null |
[CS Wikipedia] Danilo Ilić
Danilo Ilić (1891, Bosna a Hercegovina – 3. února 1915, tamtéž) byl členem tajné srbské nacionalistické organizace Černá ruka a hlavním organizátorem a vůdcem skupiny osob, které dne 28. června 1914 provedly úspěšný atentát na Františka Ferdinanda d'Este. Vystudoval Státní pedagogickou unive... | null | null | null |
null | Create an algorithm in Python to calculate the Fibonacci sequence up to a given number. | Not applicable | def fibonacci(n):
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a+b
fibonacci(100) |
null | Create a sentiment analysis web application, using Python.' | Not applicable | import flask
from flask import request, jsonify
from textblob import TextBlob
#Initialize the Flask App
app = flask.Flask(__name__)
app.config["DEBUG"] = True
#Create a route for the web application
@app.route('/', methods=['GET'])
def home():
return '<h1> Sentiment Analysis Web Application </h1>'
#Create a route f... |
null | Find the length of a string `The quick brown fox`. | 19 | |
null | Write a Python program to query Twitter to get the most recent tweets from a user. | username: @elonmusk | import tweepy
# Authenticate to Twitter
auth = tweepy.OAuthHandler("CONSUMER_KEY", "CONSUMER_SECRET")
auth.set_access_token("ACCESS_TOKEN", "ACCESS_TOKEN_SECRET")
# Create API object
api = tweepy.API(auth)
# Get the most recent tweets from the given user
tweets = api.user_timeline(screen_name="@elonmusk")
for tweet ... |
null | Create a Python function to grade a multiple choice exam based on a given Answer key and a student's answers. | Answer Key : [A, B, D, C, D]
Student's Answers: [A, A, C, B, D] | def grade_exam(answer_key, student_answers):
score = 0
for i in range(len(answer_key)):
if answer_key[i] == student_answers[i]:
score += 1
return score / len(answer_key) * 100
answer_key = ['A', 'B', 'D', 'C', 'D']
student_answers = ['A', 'A', 'C', 'B', 'D']
print("Student's exam ... |
null | Create a C# program to check if any element in an array is equal to a given number. | arr = {1, 4, 7, 9} and given number = 7 | public static bool IsEqualToGivenNumber(int[] arr, int number) { for(int i = 0; i < arr.Length; i++) { if(arr[i] == number) { return true; } } return false; } |
null | Create a SQL query to select all the records from the table ‘fruit_list’ that have an expiry date falling within the next 10 days. | SELECT * FROM fruit_list WHERE expiry_date >= CURRENT_DATE AND expiry_date < CURRENT_DATE + INTERVAL 10 DAY; | |
null | Create a cURL command that retrieves the contents of a webpage. | curl -X GET http://example.com | |
null | Can you create a Python program that returns the largest number in a list of numbers? | [4, 8, 2, 6, 9] | def largestNumber(list):
maximum = list[0]
for num in list:
if num > maximum:
maximum = num
return maximum
list = [4, 8, 2, 6, 9]
largestNumber = largestNumber(list)
print("Largest number in the given list is:", largestNumber) |
null | Create a script in Python that checks that a given URL is active and responding. | url = "http://www.example.com" | import requests
url = "http://www.example.com"
try:
request = requests.get(url)
if request.status_code == 200:
print("URL is active and responding")
except Exception as e:
print(f"Error: {e}") |
null | Generate a Python regular expression that can identify valid email addresses. | Not applicable | ^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$ |
null | Develop a function in Python that takes two strings and returns a new string that is the longest common subsequence of the two given strings. | def longest_common_subsequence(s1, s2):
m = len(s1)
n = len(s2)
dp = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if s1[i-1] == s2[j-1]:
dp[i][j] = dp[i-1][j-1] + 1
else:
dp[i][j] = max(dp[i-... | |
null | Construct an SQL query to find the name of all employees in department ID 7. | SELECT name FROM Employees WHERE departmentID = 7; | |
[EN Wikipedia] 2012 United States Senate election in Indiana
The 2012 United States Senate election in Indiana took place on November 6, 2012, concurrently with the U.S. presidential election as well as other elections to the United States Senate and House of Representatives and various state and local elections. Incu... | null | null | null |
null | Describe in code what is supervised learning. | Supervised learning is a type of machine learning that uses labeled data to train algorithms to predict outcomes. It involves using labeled data points as input and output to teach the machine how to predict outcomes. The algorithm is “supervised” because it has a pre-defined set of examples to learn from, making it ea... | |
null | Explain the following piece of JavaScript code. | let arr1 = [1,2,3,4]; let arr2 = [...arr1]; | This code creates a new array, arr2, which contains the same elements as the original array, arr1. The spread operator (...) is used to unpack the elements of arr1, and copy them into the newly created arr2. |
null | Create a UI class with methods for handling input, window destruction, and exposing. Initialize the UI class with a thread lock, shared memory object, and semaphore object. Connect the UI class to a message handler and socket. Add watch functions for input and hang up events. Create a GTK window with a title, size, and... | #!/usr/bin/python
import sys
import os
import tempfile
import gobject
import gtk
import socket
import shm
import threading
import time
import struct
import cairo
import array
import cPickle as pickle
import message
import config
#gtk.gdk.threads_init()
def olog(str):
olog_nonl(str + "\n")
def olog_nonl(str):
... | |
null | Formulate an SQL query to make this table: | Table: books book_id | book_title | book_edition ------------------------ | CREATE TABLE books ( book_id INTEGER PRIMARY KEY, book_title VARCHAR(50), book_edition VARCHAR(50) ); |
null | Create a code to save the first ten prime numbers in an array. | # prime number sieve def prime_numbers(n): prime = [True for i in range(n+1)] p = 2 while (p * p <= n): if (prime[p] == True): for i in range(p * p, n+1, p): prime[i] = False p += 1 prime_numbers = [] for p in range(2, n): if prime[p]: prime_numbers.append(p) return prime_numbers[:10] if __name__ == "__main__": n = 100... | |
null | Write the code to calculate a factorial recursively | def factorial(n): if n == 0: return 1 else: return n * factorial(n - 1) | |
[EN Wikipedia] Pycnoglypta
Pycnoglypta is a genus of beetles belonging to the family Staphylinidae. The species of this genus are found in Europe and Northern America. Species: Pycnoglypta aptera Campbell, 1983 Pycnoglypta baicalica (Motschulsky, 1860) References Staphylinidae Staphylinidae genera | null | null | null |
[EN Wikipedia] Asteraceae
The family Asteraceae (), with the original name Compositae, consists of over 32,000 known species of flowering plants in over 1,900 genera within the order Asterales. Commonly referred to as the aster, daisy, composite, or sunflower family, Compositae were first described in the year 1740. T... | null | null | null |
null | Create a JavaScript function that takes in two arrays of numbers, and returns an array containing only the numbers that appear in both arrays. | arr1 = [1, 2, 3, 4, 5]; arr2 = [3, 4, 5, 6, 7] | function containsSameNumbers(arr1, arr2) { const intersection = []; for (let i = 0; i < arr1.length; i++) { if (arr2.includes(arr1[i])) { intersection.push(arr1[i]); } } return intersection; } containsSameNumbers(arr1, arr2); // Output: [3, 4, 5] |
null | Create a simple calculator program in Python. | def simple_calculator():
num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))
oper = input("Enter your operation (+, -, *, /): ")
if oper == "+":
print("Result:", num1 + num2)
elif oper == "-":
print("Result:", num1 - num2)
... | |
null | Write a python program to calculate maximum revenue. | prices = [10, 7, 5, 8, 11, 9] | def max_revenue(prices):
diff = [prices[i + 1] - prices[i] for i in range(len(prices) - 1)]
max_diff = 0
for i in range(len(diff)):
for j in range(i + 1, len(diff) + 1):
current_diff = sum(diff[i:j])
if current_diff > max_diff:
max_diff = current_diff
... |
[CS Wikipedia] 137 (číslo)
Sto třicet sedm je přirozené číslo. Následuje po číslu sto třicet šest a předchází číslu sto třicet osm. Pořadové číslo je stý třicátý sedmý nebo stosedmatřicátý. Římskými číslicemi se zapisuje CXXXVII. Matematika Sto třicet sedm je 33. prvočíslo, tvoří prvočíselnou dvojici s číslem 139 nešť... | null | null | null |
null | Demonstrate how tog concatenate two strings in Python. | a = "Hello"
b = "World!"
c = a + b
print(c) | |
null | Convert this bubble sort algorithm from C++ to Python. | void bubbleSort(int arr[], int n)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n-i-1; j++)
{
if (arr[j] > arr[j+1])
swap(&arr[j], &arr[j+1]);
}
}
} | def bubble_sort(arr):
n = len(arr)
for i in range(n):
for j in range(n-i-1):
if arr[j] > arr[j+1]:
arr[j], arr[j+1] = arr[j+1], arr[j]
return arr
arr = [2, 3, 4, 1, 5]
print(bubble_sort(arr)) |
null | Modify the code so that it prints the given string in lowercase letters. | String: "HELLO WORLD" Code: #include<iostream> using namespace std; int main() { string s = "HELLO WORLD"; cout << s << endl; return 0; } | #include<iostream> #include<algorithm> using namespace std; int main() { string s = "HELLO WORLD"; // Convert string s to lowercase letters transform(s.begin(), s.end(), s.begin(), ::tolower); cout << s << endl; return 0; } |
null | Which basic data type is represented by the following JSON? {"name": "John", "age": 30} | The JSON given represents a basic object data type. | |
[DE Wikipedia] Mirla Castellanos
Mirla Josefina Castellanos Peñaloza (* 31. März 1941 in Valencia) ist eine venezolanische Sängerin. Castellanos debütierte 1960 als Sängerin bei Radio Caracas Televisión in der Show de Víctor. Sie arbeitete in der Folgezeit als Sekretärin des Sportjournalisten Juan Vené. Von Ricardo Ti... | null | null | null |
null | Create a JavaScript function to remove all spaces from a string. | function removeSpaces(str) { return str.replace(/ /g,""); } | |
null | Create a Python function to check if a given number is abundant or not. An abundant number is a number which is less than the sum of its proper divisors. | number = 24 | def is_abundant(number):
sum = 0
for i in range(1, number):
if number % i == 0:
sum += i
return sum > number |
null | Generate valid HTML for a table with three columns | <table> <tr> <th>Column1</th> <th>Column2</th> <th>Column3</th> </tr> </table> | |
null | Create a loop in Python that prints numbers 1 to 10. | for i in range(1, 11):
print(i) | |
[EN Wikipedia] Křížkový Újezdec
Křížkový Újezdec is a municipality and village in Prague-East District in the Central Bohemian Region of the Czech Republic. It has about 300 inhabitants. Administrative parts The village of Čenětice is an administrative part of Křížkový Újezdec. History The first written mention of Kří... | null | null | null |
null | Rewrite the following function in Python:
function add(x, y) {
return x + y;
} | Not applicable | def add(x, y):
return x + y |
null | Write a single line of code to display the current date and time in the format "Month day year, Hour:Minute” using the Python module datetime. | print(datetime.datetime.now().strftime('%b %d %Y, %H:%M')) | |
null | Create a function in Rust that takes two strings and returns true if they are anagrams. | fn anagrams(s1: &str, s2: &str) -> bool { let s1 = s1.to_lowercase().chars().collect::<Vec<char>>(); let s2 = s2.to_lowercase().chars().collect::<Vec<char>>(); s1.sort_unstable(); s2.sort_unstable(); s1 == s2 } | |
null | Can you propose a C++ program for adding two matrices? | Matrix1 = [[2, 3], [4, 5]] Matrix2 = [[6, 7], [8, 9]] | #include <iostream> #define N 2 // function to add two matrices void addMatrix(int A[][N], int B[][N], int C[][N]) { int i, j; for (i = 0; i < N; i++) for (j = 0; j < N; j++) C[i][j] = A[i][j] + B[i][j]; } int main() { int A[N][N] = {{2, 3}, {4, 5}}; int B[N][N] = {{6, 7}, {8, 9}}; int C[N][N]; // To store result addMa... |
[EN Wikipedia] Yolbulan, Ergani
Yolbulan is a neighbourhood in the municipality and district of Ergani, Diyarbakır Province in Turkey. Its population is 658 (2022). References Neighbourhoods in Ergani District | null | null | null |
null | Create an AWS Lambda function with a Python runtime for sending a message to an SNS topic. | Not applicable | import json
import boto3
def lambda_handler(event, context):
# Create an SNS Client
sns_client = boto3.client('sns')
# Send a message to the SNS topic
topic_arn = 'arn:aws:sns:eu-west-1:123456789012:my-topic'
message = 'This is a test message'
response = sns_client.publish(
TopicArn = topic_arn,
... |
null | Generate a Python program to round a floating point number to a certain number of decimal places. | 2.71828, 3 | def round_float(num, decimal_ places):
'''
Function to round a floating point number to a certain number of decimal places
'''
return round(num, decimal_places)
result = round_float(2.71828, 3)
print(result) |
null | Find the minimum of two given numbers. | 4, 6 | def min_two(a, b): if a < b: return a else: return b min_val = min_two(4, 6) print(min_val) |
null | How many jokes can you write in Python? | There is no definite answer to this question. It depends on the creativity and programming skills of the individual. It is possible to write an infinite number of jokes, but writing a joke that is funny and unique will require more effort and expertise. | |
null | Using Python, create a program to filter out all non-prime numbers from a list. | myList = [2, 4, 5, 20, 44] | def filterPrimes(myList):
result = []
for i in myList:
is_prime = True
for j in range(2,i):
if i % j == 0:
is_prime = False
break
if is_prime:
result.append(i)
return result
print(filterPrimes(myList)) #[2, 5] |
null | You are asked to create an encryption program that produces an output which should be different from its original one when decrypted. | "<noinput>" | # Python 3 program for the implementation of the Encryption Algorithm
# Method to encrypt the given string
def encrypt_string(str):
cipher = ""
for s in str:
# Shift each character by 2 ascii value
s = chr(ord(s) + 2)
cipher += s
return cipher
# Driver code
str = "pyth... |
[EN Wikipedia] 1864 in Denmark
Events from the year 1864 in Denmark. Incumbents Monarch – Christian IX Prime minister – Ditlev Gothard Monrad (until 11 July), Christian Albrecht Bluhme Events 1 February – The Second Schleswig War breaks out after the First Schleswig War had left the Schleswig-Holstein Question unsettl... | null | null | null |
null | Generate a python function to convert numbers to English words. | The function should take a number in the range of 0 to 999. | def number_to_words(number):
if number == 0:
return "Zero"
# Variables to keep track of output
output = ""
# Placeholders for each of the three digits
ones_place = ["", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"]
tens_place = ["", "", "Twenty", "Thirty"... |
[EN Wikipedia] The Woman in White (1966 TV series)
The Woman in White is a British drama television series which originally aired on BBC 1 in six 25-minute-long episodes between 2 October and 6 November 1966. It was adapted from the 1860 novel The Woman in White by Wilkie Collins. As of 2021, none of the six episodes ... | null | null | null |
null | Design a JSON schema for an item. | { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "price": { "type": "number" }, "quantity": { "type": "integer" } }, "required": ["id", "name", "price", "quantity"] } | |
null | Write a regex to match the email address format. | regex = r'^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$' | |
[DE Wikipedia] Isarmündung
Die Isar ist ein Zufluss der Donau. Das Isarmündungsgebiet liegt zu einem großen Teil im Bereich der Gemeinde Moos, südlich des Stadtzentrums von Deggendorf und östlich von Plattling. An 18 km der Isar liegt hier eine vielfältige Auenlandschaft, in der die Natur großenteils sich selbst überl... | null | null | null |
null | Create a Python program to check for anagrams of a string. | "listen", "silent" | def anagramCheck(str1, str2):
if (len(str1) != len(str2)):
return False
str1 = sorted(str1)
str2 = sorted (str2)
# Compare each character in str1 with
# each character in str2
for i in range( len( str1 ) ):
if (str1[i] != str2[i]):
return False
return True |
null | Create a machine learning model in Python to predict the total surface area of a cube given its side length | side_length = 3 | import numpy as np from sklearn.linear_model import LinearRegression # Data X_train = np.array([1, 2, 3, 4, 5]).reshape(-1, 1) y_train = np.array([6, 12, 18, 24, 30]) # Model model = LinearRegression() model.fit(X_train, y_train) # Prediction side_length = 3 pred = model.predict([[side_length]]) print('The surface area... |
null | Using the class group, create an instance of the StudentClass and print out its name attribute. | class StudentClass: def __init__(self, name): self.name = name | # create an instance of the StudentClass student_class = StudentClass("Statistics") #print out its name attribute print(student_class.name) # Output: Statistics |
[DE Wikipedia] Laubach (Eifel)
Laubach ist eine Ortsgemeinde im Landkreis Cochem-Zell in Rheinland-Pfalz. Sie gehört der Verbandsgemeinde Kaisersesch an. Geographie Laubach liegt fünf Kilometer westlich der Stadt Kaisersesch auf einem mit dem hier entspringenden Kaulenbach nach Süden abfallenden Gelände. Die Ortschaft... | null | null | null |
null | Create a web scraper in Python to scrape the top 10 products from a bike parts website. | #import libraries
import requests
from bs4 import BeautifulSoup
#specify the url and fetch the data from the server
url = 'https://examplewebsite.com/'
page = requests.get(url)
#parse the html content
soup = BeautifulSoup(page.content, 'html.parser')
#get all the product listings
listings = soup.find_all('div', c... | |
null | Create a class in Python containing an add_student() method. | class StudentList:
def __init__(self):
self.students = []
def add_student(self, student):
self.students.append(student) | |
null | Write a Python program to find the maximum size of a subset such that no three elements in the subset are in arithmetic progression. | [1,2,4,7,8,11,14,15] | def findMaxSubset(arr):
n = len(arr)
dp = [[True for i in range(n)] for i in range(n)]
for l in range(n - 2, 0, -1):
for i in range(n - l):
j = l + i
if (arr[j]-arr[i] == arr[j-1] - arr[i+1]):
dp[i][j] = False
else:
flag... |
[CS Wikipedia] Bironové
Bironové (německy původně Bühren, později Biron von Curland - Kuronští Bironové) je baltský německý šlechtický rod, který během 18. století vládla v Kuronsko-zemgalském vévodství (léno polské koruny), na území dnešního Lotyšska. Bironové se stali vládci baltského vévodství namísto původně vládn... | null | null | null |
null | Create a class in Java called Student that stores four pieces of data: name, id, major, and gpa. | class Student { // data members String name; int id; String major; double gpa; // constructors Student(String name, int id, String major, double gpa) { this.name = name; this.id = id; this.major = major; this.gpa = gpa; } // method 1 public String getName() { return this.name; } // method 2 public int getId() { return ... | |
[CS Wikipedia] Coulomb
Coulomb je odvozená jednotka SI veličiny elektrický náboj. Pojmenována byla na počest francouzského fyzika Charlese-Augustina de Coulomba. Značkou coulombu je C. Definice Je definován jako elektrický náboj přenesený proudem 1 ampéru během 1 sekundy (tzn. 1 coulomb = 1 ampérsekunda). C = A ⋅ s Vl... | null | null | null |
null | Write a JavaScript program to make an AJAX request. | const request = new XMLHttpRequest(); request.open('GET', 'https://example.com/data.json'); request.onload = () => { const data = JSON.parse(request.responseText); // Handle response data }; request.send(); | |
null | Create a python program to ask the user to enter three numbers and add the two smallest of them | # Take three numbers from the user
Num1 = int(input("Enter first number: "))
Num2 = int(input("Enter second number: "))
Num3 = int(input("Enter third number: "))
# Find the two smallest numbers
def two_smallest_nums(Num1, Num2, Num3):
smallest_num = min(Num1, Num2, Num3)
mid_num = max( min( Num1, Num2 ), min( Nu... | |
[CS Wikipedia] Národní park Rawa Aopa Watumohai
Národní park Rawa Aopa Watumohai je indonéský národní park, který leží na ostrově Sulawesi (Celebes) v provincii Jihovýchodní Sulawesi. Byl založen v roce 1989 a má rozlohu 1 050 km2. Nadmořská výška sahá od hladiny moře po 981 metrů. Park chrání rašelinový les Aopa, nej... | null | null | null |
null | Parse the following string to obtain all the digits. | str1 = "Price of the product is $128." | '128' |
null | Write a JavaScript function that takes an input string and replaces all occurrences of the letter 'e' with an asterisk. | input_string = "Hello World!" | function replace_with_asterisk(string) { return string.replace(/e/g, '*'); } |
null | Create a GUI program in Python to ask a user to input any text and display the output. | import tkinter as tk
# Create window
window = tk.Tk()
window.title("Input-Output Program")
window.geometry("400x200")
# Create a Label
message_heading = tk.Label(text="Input:")
message_heading.grid(column=0, row=0)
# Create a text entry box
text_entry = tk.Entry()
text_entry.grid(column=1, row=0)
# Create a S... | |
null | Write a Python function that converts a given number from one numeric base to another. | number = 42
from_base = 10
to_base = 16 | def convert_number(number, from_base, to_base):
# convert number to base 10
result = int(str(number), from_base)
# convert base 10 to new base
res = ""
while result > 0:
res += str(result % to_base)
result //= to_base
res = res[::-1]
return res |
null | Using the given dictionary, find the most frequent element | my_dict = {"A":1,"B":1,"C":3,"D":3,"E":3} | most_frequent = max(my_dict, key=my_dict.get) print(most_frequent) |
null | Edit the existing JavaScript code to make it pass Eslint. | var foo = "foo" if (foo) { console.log("foo is true") } | var foo = "foo"; if (foo) { console.log("foo is true"); } |
null | Create an HTML page that displays a table containing four columns: first name, last name, age, and city. Put your own data into the columns. | <html> <head> <title>People Table</title> </head> <body> <table> <tr> <th>First Name</th> <th>Last Name</th> <th>Age</th> <th>City</th> </tr> <tr> <td>John</td> <td>Doe</td> <td>50</td> <td>New York</td> </tr> <tr> <td>Jane</td> <td>Smith</td> <td>41</td> <td>Los Angeles</td> </tr> <tr> <td>Dave</td> <td>Jackson</td> <... | |
null | How do you install the Django web framework? | Install Django using pip by running the following command from the command line: pip install Django You can also install Django from source: git clone https://github.com/django/django.git cd django python setup.py install | |
null | Write a Python program to create a histogram representing the frequency distribution of a set of data. | [1, 2, 3, 4, 5, 5] | import matplotlib.pyplot as plt
data = [1, 2, 3, 4, 5, 5]
plt.hist(data, bins=5)
plt.title("Frequency Distribution")
plt.show() |
null | Explain what is linear regression. | Linear regression is a statistical technique used for predictive modeling. It attempts to find the line of best fit for a set of data by minimizing the sum of squares between the estimated line and observed data points. The equation of the line of best fit gives an estimate of the dependent variable given certain value... | |
null | Construct a function in Python which takes in a string and returns the number of vowels it has. | string="hello world" | def countVowels(string):
vowels = 'aeiouAEIOU'
count = 0
for char in string:
if char in vowels:
count += 1
return count |
null | Write an algorithm to determine if an input string is a palindrome. | racecar | def is_palindrome(string): string = string.lower() rev_string = string[::-1] if string == rev_string: return True return False if __name__ == '__main__': print(is_palindrome('racecar')) |
[CS Wikipedia] Paraphysothele novotnyi
Paraphysothele novotnyi (doposud nemá české jméno) je malý druh lišejníku objevený roku 1897 německým lichenologem českého původu Wenzlem Novotnym. Vyskytuje se na území Švýcarska, ale Thomas Douglas Victor Swinscow, objevitel mnoha variant druhu Heterodermia , ve své publikaci P... | null | null | null |
null | Implement a breadth-first search algorithm to find the shortest path between two nodes. | def BFS(graph, start, end): # Create an empty queue queue = [] # Create a set to store visited nodes visited = set() # Enqueue the starting node queue.append([start]) while queue: # Get the first path and process it path = queue.pop() # Get the last node from the path node = path[-1] if node == end: return path elif no... | |
null | Develop a function that is able to print a list of consecutive numbers between 1 and N, given an integer N as argument. | N = 5 | def print_n_numbers(N): for x in range(1,N+1): print (x) print_n_numbers(N) # Output: 1 2 3 4 5 |
null | Determine the size of an array in bytes. | The size of an array in bytes is equal to the number of elements in the array multiplied by the size of each element in bytes. For example, an array of 10 integers requires 10 * 4 = 40 bytes of memory. | |
[DE Wikipedia] St.-Johannes-Kirche (Wiefelstede)
Die evangelisch-lutherische St.-Johannes-Kirche in Wiefelstede im Landkreis Ammerland geht auf den ältesten Kirchenbau des Ammerlandes zurück. Der Kirchenbau wurde um 1200 begonnen und bis ins 15. Jahrhundert stetig verändert. Das Gotteshaus enthält bemerkenswerte Ausst... | null | null | null |
null | Using the provided snippet of code below, create a function in Java to convert a given array of strings to lowercase. | public static String[] toLowerCase(String[] words) { String[] lowerWords = new String[words.length]; for (int i = 0; i < words.length; i++) lowerWords[i] = words[i].toLowerCase(); return lowerWords; } | |
null | The given code is a Python class named FileSystem that provides an interface for file system operations. To use this class, create an instance of it and call its methods. The methods include abspath, realpath, path_to_module, expanduser, basename, chdir, copyfile, dirname, exists, dirs_under, files_under, getcwd, glob,... | # Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.