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
Generate a correct HTML anchor tag for a link to "example.com"
<a href="https://example.com">example.com</a>
[HI Wikipedia] गागाउज़ भाषा गागाउज़ (Gagauz dili) एक तुर्की भाषा है जो मोल्दोवा के गागाउज़िया क्षेत्र की सरकारी भाषा है और जिसे मुख्य रूप से गागाउज़ समुदाय के लोग बोलते हैं। ध्यान दें कि एक अन्य 'बालकनी गागाउज़ तुर्की' नामक भाषा भी है लेकिन भाषावैज्ञानिक इन दोनों को भिन्न मानते हैं। इन्हें भी देखें क़शक़ाई भाषा तुर्की...
null
null
null
[EN Wikipedia] Angelina Banytė Angelina Banytė (born 1949) is a Lithuanian painter. She graduated from the Lithuanian Institute of Art in 1974. Since 1978, she has been a member of Lithuanian artists' association. Her work appears at the Clock Museum. Since 1976, she has lived in Klaipėda. Works Dainavos šalis – "Dain...
null
null
null
[DE Wikipedia] König (Kartenspiel) König (türkisch: Rifki, französisch: Le jeu du roi, englisch und italienisch: King) ist ein Kartenspiel, das mit Barbu verwandt ist und die Grundregeln der einfacheren Spiele Herzeln und Kein Stich eingebaut hat. Gespielt wird es vor allem in Frankreich, Belgien und Italien. Es ist a...
null
null
null
null
Create a search algorithm in Python using a binary search, that takes an array of integers and a number as an argument and returns the position of the number within the array if the number exists.
array = [1, 3, 8, 10, 12, 15, 17, 20, 22, 34, 38, 40] number = 15
def binary_search(array, target): left = 0 right = len(array) - 1 while left <= right: middle = (left + right)//2 if array[middle] < target: left = middle + 1 elif array[middle] > target: right = middle - 1 else: return middle ...
null
Construct an algorithm in Python to sort the elements of an array in decreasing order.
[4, 7, 1, 3, 5, 2]
def sortDecreasing(arr): for i in range(len(arr)): for j in range(i+1, len(arr)): if arr[i] < arr[j]: arr[i], arr[j] = arr[j], arr[i] return arr arr = [4, 7, 1, 3, 5, 2] print(sortDecreasing(arr)) # Output: [7, 5, 4, 3, 2, 1]
null
Write a python program to submit the following operation
Calculate the maximum sum of a contiguous subarray in the given array.
def max_contiguous_sum(arr): max_sum = 0 current_sum = 0 for i in range(len(arr)): current_sum += arr[i] if current_sum > max_sum: max_sum = current_sum if current_sum < 0: current_sum = 0 return max_sum
null
Edit the following Python class such that it can accept a variable number of parameters.
class Person: def __init__(self, name, age, weight): self.name = name self.age = age self.weight = weight
class Person: def __init__(self, *args): self.name = args[0] self.age = args[1] self.weight = args[2]
[EN Wikipedia] National Federation of Retail Newsagents The National Federation of Retail Newsagents (NFRN) is an employers association representing more than 10,000 stores across the United Kingdom and the Republic of Ireland. Its roots go back to the latter part of the nineteenth century. History The roots of the NF...
null
null
null
null
Construct a Python function which takes two strings as input arguments and returns their concatenation.
"Hello ", "World!"
def concat_strings(str1, str2): return str1 + str2 result = concat_strings("Hello ", "World!") print(result)
null
Create a Python program which takes a list of integers and prints a list containing only those integers which have more than 2 occurrences in the input list.
list = [1, 2, 3, 4, 5, 2, 3, 1, 6, 3]
list = [1, 2, 3, 4, 5, 2, 3, 1, 6, 3] def findDuplicates(list): result = [] seen = set() for num in list: if num not in seen: seen.add(num) else: result.append(num) return result print(findDuplicates(list))
null
Compose Python code to remove all elements from a list by value.
mylist = [1,2,3,4,2]
def remove_by_val(mylist, val): return [i for i in mylist if i != val] mylist = [1,2,3,4,2] result = remove_by_val(mylist, 2) print("Updated list after removing elements are: ", result)
null
Create a class in Python that implements a method to convert a decimal to a binary number.
Not applicable
class DecimalToBinary: def __init__(self, num): self.num = num def convert(self): if self.num > 1: self.convert(self.num // 2) print(self.num % 2, end='') number = DecimalToBinary(14) number.convert()
null
Write a method that prints out all the prime numbers between 1 and 100.
public static void printPrimeNumbers(){ System.out.println("Prime numbers between 1 to 100 are : "); for (int i = 1; i <= 100; i++) { boolean isPrime = true; for (int j = 2; j < i; j++) { if (i % j == 0) { isPrime = false; break; } } if (isPrime) System.out.print(i + " "); } } // Output: // Prime numbers between 1 to 1...
null
You receive an array of numbers as input and you need to calculate the median number.
arr = [3, 2, 4, 1, 5]
3.0
null
Create a Python program to generate random strings using a given character set.
Character Set: 'abc' String Length: 5
import random def generate_random_string(length, char_set): random_string = '' for _ in range(length): random_string += random.choice(char_set) return random_string char_set = 'abc' length = 5 print(generate_random_string(length, char_set))
[HI Wikipedia] लीवर सिरोसिस सिरोसिस यकृत की कैंसर के बाद सबसे गंभीर बीमारी है, इस बीमारी का इलाज लीवर प्रत्यारोपण के अलावा और कोई नहीं है। इस रोग में यकृत कोशिकाएं बडे पैमाने पर नष्ट हो जाती हैं और उनके स्थान पर फाइबर तंतुओं का निर्माण हो जाता है। यकृत की बनावट भी असामान्य हो जाती है, जिससे पोर्टल हाइपरटैंशन की स्थिति...
null
null
null
[DE Wikipedia] Specific-Pathogen-Free Specific-pathogen-free (SPF, deutsch: spezifisch pathogenfrei) bezeichnet in der Versuchstierhaltung und der Zellkultur-Technik die Abwesenheit bestimmter Krankheitserreger (Pathogene), wie Bakterien, Pilze und Viren. Die Federation of Laboratory Animal Science Associations (FELAS...
null
null
null
null
Generate a dictionary with the key-value pairs {1:1, 2:4, 3:9, 4:16}
def generate_dict(): """Generate a dictionary with the key-value pairs {1:1, 2:4, 3:9, 4:16}""" my_dict = {} for i in range(1, 5): my_dict[i] = i**2 return my_dict generate_dict() # Outputs {1:1, 2:4, 3:9, 4: 16}
null
Compute the result of the following mathematical expression in Python.
(4 + 5 * 7 - 9) / 2
result = 17
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;
[CS Wikipedia] Mladí zelení Mladí zelení, z.s. (zkratka "MZ") je spolek sdružující mladé lidi, kteří se zajímají mj. o témata klimatické krize, genderové rovnosti, práv LGBTQIA+ osob, sociálně ohrožených skupin a dalších. Členstvo MZ se o těchto tématech vzdělává a snaží se pro ně získávat větší pozornost ve veřejném ...
null
null
null
[HI Wikipedia] पारामारिबो जिला पारामारिबो सूरीनाम का जिला है। जिले में पारामारिबो शहर और आसपास के क्षेत्र शामिल हैं। 2004 की जनगणना के अनुसार जिले की आबादी 243,640 है और इसका क्षेत्रफल 183 वर्ग किलोमीटर है। आबादी और सघनता के अनुसार यह सूरीनाम का सबसे बड़ा जिला है। इतिहास क्षेत्र को सबसे पहले 17वी शताब्दी में विलोबे कि...
null
null
null
null
What should this function take as input and return?
def find_longest_word(words):
def find_longest_word(words): '''This function takes a list of words as input and returns a string containing the longest word''' longest_word = '' for word in words: if len(word) > len(longest_word): longest_word = word return longest_word
null
How to remove the last character of a string in Python?
word = "Hello"
word = word[:len(word)-1]
null
Write a Python program to find the common elements between two lists
list1: [2, 4, 6, 8] list2: [4, 6, 10, 12]
def common_elements(list1, list2): # Make a copy of list list_copy = list2[:] # Iterate the original list for item in list1: if item in list_copy: list_copy.remove(item) # Return the common elements return list(set(list1) & set(list2))
null
Write an R program to find the square of a number
x <- 5 square_x <- x * x; print(paste0('The square of ',x,' is ',square_x))
null
Write pseudocode for the merge sort algorithm.
Mergesort(A): if A has 1 item : return A else divide A into two parts (left and right) of roughly equal size B = Mergesort(left) C = Mergesort(right) D = Merge(B,C) return D Merge(B,C): create an empty list D while B and C are not empty: if B[0] ≤ C[0]: add the first item of B to the end of D remove the first item of B...
null
Build a Python program which takes an integer number as input and checks if it is an Armstrong number.
A number (integer).
def isArmstrong(number): sum = 0 temp = number while temp > 0: remainder = temp % 10 sum += remainder ** 3 temp //= 10 if (number == sum): return True else: return False number = 153 if (isArmstrong(number)): print(number,"is an Armstrong number") els...
null
Implement this algorithms in Python.
Algorithm: Depth-first Search
def dfs(graph, start): visited = [] stack = [start] while stack: vertex = stack.pop() if vertex not in visited: visited.append(vertex) for node in graph[vertex]: stack.append(node) return visited
null
Create a Python dictionary with customer details provided.
Name: John Age: 25 Gender: Male Occupation: Chef
customer = { 'name': 'John', 'age': 25, 'gender': 'Male', 'occupation': 'Chef' }
null
The given code is a Python script that defines a class called "ManyJetsHiggsVarFiller" which adds new variables to a ROOT tree. To use this class, you need to import it from the "tree.gardening" module and create an instance of it. Then, you can call the "process" method of the instance, passing the input and output RO...
from tree.gardening import TreeCloner import optparse import sys import ROOT import numpy import re import os.path import math from math import * from array import array; # # # \ | | | | | _) # |\/ | _` | __ \ | | | _ \ __| | | | _` | ...
null
Create a Python function to evaluate a given expression using the PYEXPR language.
expr = "2 + 3 * 4 - 8"
def evaluateExpression(expr): result = 0 expr = expr.replace(' ', '') tokens = expr.split('+') for token in tokens: terms = token.split('-') for term in terms: factors = term.split('*') for factor in factors: result += int(factor) if term.startswith('-'): result *= -1 if token.startswi...
null
Create a C program that prints the number of times a character is present in a given string.
String: Antman Character: n
#include <stdio.h> #include <string.h> int main() { char str[] = "Antman"; char c = 'n'; int count = 0; for (int i=0; i<strlen(str); i++) { // checking character in str if (str[i] == c) count++; } printf("Number of %c in %s is %d", c, str, count); return 0; }
null
Create a python function which sorts an array of integers into ascending order.
[3, 7, 8, 1, 5, 4]
def sort_int_asc(arr): arr.sort() return arr print(sort_int_asc([3, 7, 8, 1, 5, 4]))
null
Write HTML code to produce a two-column table with one row.
<table> <tr> <td>row 1, col 1</td> <td>row 1, col 2</td> </tr> </table>
null
Create a function in Java to take a sentence as input and return a list of all the words in the sentence.
I am a student
# Using Java: public static List<String> getWords(String sentence) { List<String> words = new ArrayList<>(); String[] wordsArray = sentence.split("\\s+"); for (String word : wordsArray) { words.add(word); } return words; }
null
Find the indices of the elements in the following array and output them in the form of a list.
Array = [5, 4, 6, 8, 7]
indices = [] for i, element in enumerate(a): indices.append(i) Output: [0, 1, 2, 3, 4]
null
Create a program that can generate anagrams from a set of words.
['python', 'coding', 'programming']
""" Create a program to generate anagrams from a set of words. # Importing libraries import itertools def anagrams(words): # Generate all permutations of the given words anagram_list = [''.join(permutation) for permutation in itertools.permutations(words)] # Return the list of anagrams return anagr...
[EN Wikipedia] Y. M. Rizer House The Y. M. Rizer House, also known as Mapleshade, is an Italianate and Second Empire style house dating from c.1874 in Franklin, Tennessee that was listed on the National Register of Historic Places in 1988. According to a 1988 study of Williamson County historical resources, it is one ...
null
null
null
null
Replace all the negative numbers in an array to zero using Ruby.
arr = [3, 4, -2, -1]
# Replace all negative numbers in an array to zero arr.each_with_index do |num, i| arr[i] = 0 if num < 0 end
null
Develop a method to achieve the linear interpolation between two given points
def linear_interpolation(x1, y1, x2, y2): # slope m = (y2 - y1) / (x2 - x1) # intercept c = y2 - (m * x2) return m, c
[DE Wikipedia] Neue Gesellschaft für Bildende Kunst Die neue Gesellschaft für bildende Kunst (nGbK) ist ein deutscher Kunstverein. Er wurde 1969 mit basisdemokratischer Struktur gegründet und ist nach eigenen Angaben einer der bundesweit bedeutendsten und mitgliederstärksten Vereine seiner Art. Seine Ausstellungsräume...
null
null
null
[EN Wikipedia] A. J. Gray Andrew Richard Gray Jr. (born April 12, 1988) is a Canadian retired soccer player who played as a winger. Career Gray began his career in Sweden with fifth-tier side Juventus IF in 2012. He had spells with Ventura County Fusion, OPS and FC Haka, before signing with United Soccer League side O...
null
null
null
[CS Wikipedia] Albert Škarvan Albert Škarvan (31. ledna 1869 Tvrdošín – 29. března 1926 Liptovský Hrádok) byl slovenský lékař, stoupenec Tolstého. V roce 1907 vydal první slovenskou učebnici esperanta. Napsal mnoho článků pro různé esperantské časopisy, a také (slovensky) psané eseje, vyjadřující se s osobitým přístup...
null
null
null
[EN Wikipedia] Bachlechner Bachlechner is a German surname. Notable people with the surname include: Klaus Bachlechner (born 1952), Italian footballer Thomas Bachlechner (born 1980), Italian footballer, son of Klaus German-language surnames
null
null
null
null
Define a class for a student.
class Student: '''Creates a class object to represent a student.''' def __init__(self, name, age, grade): '''Initiate the class with name, age, and grade.''' self.name = name self.age = age self.grade = grade def get_name(self): '''Return the student name.''' return self.name def get_age(self): '''Return the student ag...
[EN Wikipedia] Argentines Argentines are the people identified with the country of Argentina. This connection may be residential, legal, historical or cultural. For most Argentines, several (or all) of these connections exist and are collectively the source of their being Argentine. In the past the National Gentilic f...
null
null
null
null
Create a Python program to join two strings together.
string1 = "Hello," string2 = "World!"
def join_strings(string1, string2): return string1 + string2
null
In JavaScript, write a function which can split a string into its constituent words.
function split_string_to_words(string) { return string.split(' '); }
null
Explain what is meant by the term ‘machine learning’.
Machine learning is the process of teaching a machine to recognize patterns in data and make decisions based on those patterns. It involves feeding a machine large amounts of data, which it can then use to learn, develop and form predictions based on patterns it identifies.
[DE Wikipedia] Charles Léon Stephen Sauvestre Charles Léon Stephen Sauvestre, nach anderen Quellen auch Stephen Eugène Sauvestre, (* 26. Dezember 1847 in Bonnétable; † 1919) war ein französischer Architekt, der vor allem für seine Überarbeitung des Eiffelturms bekannt wurde. Leben Sauvestre wurde 1847 als Sohn von Nic...
null
null
null
null
Using the given snippet of code, create a compiler to check if a given string is valid Python code.
import ast def check_syntax(code): try: ast.parse(code) except SyntaxError: return False else: return True
null
Given two arrays of integers, find the common elements.
arr1 = [1, 2, 3, 4, 5]; arr2 = [4, 5, 6, 7, 8]
def common_elements(arr1, arr2): common = [] for item in arr1: if item in arr2: common.append(item) return common
null
Create a dictionary with keys 'a' and 'b' and values 1 and 2 respectively.
dict = {'a': 1, 'b': 2}
null
Find all instances of the given symbol in the text.
text = "The company has a $1 billion budget" symbol = "$"
The symbol "$" occurs 1 time in the given text.
null
Combine the two strings into one and save it as a variable called full_name.
first_name = 'John' last_name = 'Smith'
first_name = 'John' last_name = 'Smith' full_name = first_name + ' ' + last_name
null
Create a function in Python that prints the statistics of a given numeric array.
def print_statistics(arr): min_val = min(arr) max_val = max(arr) mean_val = sum(arr)/len(arr) std_val = np.std(arr) print("Min: " + str(min_val)) print("Max: " + str(max_val)) print("Mean: " + str(mean_val)) print("Standard Deviation: " + str(std_val))
null
Rebuild the provided code using CSS flexbox.
<div> <div style="float:left;width:50%;">Left</div> <div style="float:right;width:50%;">Right</div> </div>
<div style="display:flex;"> <div style="flex: 1;">Left</div> <div style="flex: 1;">Right</div> </div>
null
Create a string manipulation program in Python that takes a user input string and outputs a version of the string with all characters in upper-case.
Hello World
userString = input("Enter a string: ") uppercasedString = userString.upper() print(uppercasedString)
[EN Wikipedia] Sinclair River The Sinclair River is a river of the Canterbury region of New Zealand's South Island. It flows south from the Jollie Range and is one of the headwaters of the Clyde River, part of the upper Rangitata River system. See also List of rivers of New Zealand References Rivers of Canterbury, New...
null
null
null
[HI Wikipedia] नया नियम नया नियम ईसाइयों के धर्मग्रन्थ बाइबिल का दूसरा भाग या उत्तरार्ध है। यीशु मसीह की जीवनी, शिक्षाएं, और उनके शिष्यों द्वारा धर्मप्रचार इसमें शामिल हैं। नया नियम 27 किताबों का संग्रह है, जो कि तीन भागों में विभाजित हैं: सुसमाचार (४), कार्य (१) और पत्रियाँ (२२; १४-पॉल, ७-कैथोलिक, १-इल्हाम)। नए नियम ...
null
null
null
[CS Wikipedia] Pala (obec) Obec Pala (estonsky Pala vald) je bývalá samosprávná obec náležející do estonského kraje Jõgevamaa. Jako místní samospráva byla založena roku 1893 sjednocením samospráv místních panství Pala, Alliku a Kadrina, církevního statku Kodavere a obce Jõe. Její rozloha se výrazně zvětšila roku 1939,...
null
null
null
null
Generate a code in Python to merge two given sorted lists into a new sorted list.
list1 = [1,5,8,9,11] list2 = [2,3,7,10]
def merging_lists(list1, list2): # Merge two sorted lists merged_list = [] i, j = 0, 0 while i < len(list1) and j < len(list2): if list1[i] <= list2[j]: merged_list.append(list1[i]) i += 1 else: merged_list.append(list2[j]) j += 1 # Add...
null
Create a Python script that takes in two lists as inputs and generates a list containing all possible pairings between elements from both lists.
Input 1: [1, 2, 3] Input 2: ['a', 'b', 'c']
list1 = [1,2,3] list2 = ['a', 'b', 'c'] pairs = [] for x in list1: for y in list2: pairs.append((x,y)) print(pairs) // Output: [(1, 'a'), (1, 'b'), (1, 'c'), (2, 'a'), (2, 'b'), (2, 'c'), (3, 'a'), (3, 'b'), (3, 'c')]
null
You are given a string and you want to sort all characters in the string alphabetically.
sorted_string = ''.join(sorted(string))
[DE Wikipedia] Michael Born (Journalist) Michael Born (* 30. Juli 1958 in Lahnstein; † 4. März 2019 in Graz, Österreich) war ein deutscher Fernsehjournalist. Born wurde 1996 als „Filmfälscher“ und „Kujau des Fernsehens“ bekannt, nachdem zahlreiche seiner vermeintlichen Dokumentarfilme, die er für die Fernsehmagazine S...
null
null
null
null
List all the prime numbers less than a specified number ‘n’
n = 10
def is_prime(n): """Returns True if n is a prime number and False otherwise.""" if n < 2: return False if n == 2: return True if n % 2 == 0: return False for i in range(3, int(n**0.5) + 1, 2): if n % i == 0: return False return True def prime_numbers_less_than(n): """Returns a list of all prime numbers less than n.""" ...
null
Write a Bash command to list the top 20 processes that are currently running on the system.
ps -aux --sort=-%cpu | head -n 20
null
Discuss the pros and cons of using class properties in C#.
Class properties make code more readable and shorter by allowing the user to access and set private variables without having to declare a public method for each. Additionally, class properties make it easy to control access rules for class variables, as you can create getters and setters for variable access, allowing y...
null
Write a Python function to find two numbers in an array with the largest sum.
[3, 10, -3, -2, 5]
def max_sum(arr): max_val = float('-inf') for i in range(len(arr)): for j in range(i + 1, len(arr)): max_val = max(max_val, arr[i] + arr[j]) return max_val result = max_sum([3, 10, -3, -2, 5]) print(result)
null
Implement Naive Bayes for classification.
import numpy as np # Create a data set X = np.array([[0, 0, 0], [0, 1, 0], [1, 0, 0], [1, 1, 0], [0, 0, 1], [0, 1, 1], [1, 0, 1], [1, 1, 1]]) y = np.array([0, 0, 0, 0, 1, 1, 1, 1]) # Build a Naive Bayes classifier naive_bayes = GaussianNB() # Train the classifier using the training data naive_bayes.fit(X, y)
null
Create an HTML page with a form that has two inputs: Name and Email.
<html> <head> <title>Submission Form</title> </head> <body> <form> <label for="name">Name: </label> <input type="text" name="name" id="name" /> <label for="email">Email: </label> <input type="email" name="email" id="email" /> <input type="submit" value="Submit" /> </form> </body> </html>
[EN Wikipedia] Marvin Piñón Marvin Leonardo Piñón Polanco (born 12 June 1991) is a Mexican professional footballer who plays as a midfielder. Club career Piñón was one of the young promises of Monterrey but only played a few minutes with the senior team. He made his senior team debut on January 8, 2011, as a starter i...
null
null
null
null
Write a Python program to print “Hello, World!” five times.
for _ in range(5): print("Hello, World!")
null
Construct a function to check whether a string is a valid IPv4 address or not.
def is_valid_ipv4(string): # Split the string at the '.'s parts = string.split(".") # Check if the length of the parts is valid if len(parts) != 4: return False # Iterate over each part and check if it is a valid number for part in parts: if not part.isdigit() or int(part) > 255 or int(part) < 0: return False return Tr...
[CS Wikipedia] Stav tělesa Stav tělesa je „vnitřní“ stav tělesa v daném časovém okamžiku, popsán stavovými veličinami jako je např. objem, tlak, teplota, vnitřní energie, počet částic. Termodynamika zkoumá změny stavu tělesa, neboli termodynamické děje. Související články Termodynamika Stavová veličina Termodynamický ...
null
null
null
[DE Wikipedia] USS Hoel (DDG-13) Die USS Hoel (DDG-13) war ein Zerstörer der Charles-F.-Adams-Klasse in Diensten der United States Navy. Geschichte Die Hoel wurde 1957 bei der Defoe Shipbuilding Company in Bay City, Michigan in Auftrag gegeben, 1959 dort auf Kiel gelegt und 1960 vom Stapel gelassen. Das Schiff wurde g...
null
null
null
null
Edit the following Python code to remove duplicate values in the given array.
arr = [1, 2, 4, 2, 5, 4]
arr = [1, 2, 4, 5] unique_arr = [] for element in arr: if element not in unique_arr: unique_arr.append(element) print(unique_arr) # [1, 2, 4, 5]
[CS Wikipedia] Džungarie Džungarie nebo Džungarsko (mongolsky Зүүнгар, Dzűngar; kazašsky Жоңғар, Žoŋğar; ujgursky جۇڭغار, Džungghar; čínsky ZZ 准噶尔, pchin-jin Zhǔngá'ěr, Čun-ka-er; rusky Джунгария, Džungarija) je geografická oblast na severozápadě Číny přibližně odpovídající severní polovině dnešní provincie Sin-ťiang....
null
null
null
[DE Wikipedia] Wadi Bani Khalid Das Wadi Bani Khalid () ist ein etwa 150 Kilometer südöstlich von Maskat liegendes Wadi, das in etwa Höhe im Hadschar-Gebirge entspringt und in das 110 Kilometer entfernte Arabische Meer mündet. Es ist das bekannteste Wadi im Distrikt Schamal asch-Scharqiyya in Oman. In seinem Verlauf s...
null
null
null
null
Given the following Java code, can you spot the error?
public class MyClass { int x = 10; int y = 20; public static int add(int x, int y) { int sum = x + y; return sum; } }
The method add() is a static method and cannot directly access the instance variables x and y. The error can be fixed by passing in the two parameters x and y to the add() method: public static int add(int x, int y) { int sum = x + y; return sum; }
null
Count the number of occurrences of the letter “a” in a given string.
string = "My favorite animal is a dog"
# 3
[HI Wikipedia] पह्लव पह्लव एक प्राचीन जाति। प्रायः प्राचीन पारसी या ईरानी। मनुस्मृति, रामायण, महाभारत आदि प्राचीन पुस्तकों में जहाँ-जहाँ खस, यवन, शक, कांबोज, वाह्लीक, पारद आदि भारत के पश्चिम में बसनेवाली जातियों का उल्लेख है वहाँ-वहाँ पह्लवों का भी नाम आया है। उपर्युक्त तथा अन्य संस्कृत ग्रंथों में पह्लव शब्द सामान्य ...
null
null
null
null
Create a class for the 'customer' entity in Python, providing the following functionalities: get customer name and get customer phone number.
class Customer: def __init__(self, name, phone_number): self.name = name self.phone_number = phone_number def get_name(self): return self.name def get_phone_number(self): return self.phone_number
null
Write a SQL query to find the first two digits of an integer value in a column.
Table name: customerinfo Column name: accountNumber
SELECT SUBSTRING(accountNumber, 1, 2) FROM customerinfo;
null
Detect and output any phone numbers in the give text.
Text: Hello, my name is John and my phone number is (123) 456-7890.
(123) 456-7890
null
Create an algorithm to determine if two strings have the same character set in Python.
Strings: "paris" and "sapir"
def same_charset(str1, str2): str1 = sorted(str1) str2 = sorted(str2) if(str1 == str2): return True else: return False
null
Create an AI program in Python that predicts the temperature on a given day.
csv file with the following data: day; temperature 1; 25 2; 28 3; 29 4; 24 5; 26 6; 25 7; 27 8; 29 9; 28 10; 28
import pandas as pd import numpy as np # read the csv file data = pd.read_csv('temperature_data.csv') # define feature and target variables X = data['day'].values.reshape(-1,1) y = data['temperature'].values # train the model from sklearn.linear_model import LinearRegression model = LinearRegression() model.fit(X, y...
[HI Wikipedia] ट्रीगवी ली ट्रीगवी हल्ब्दन ली (; 16 जुलाई 1896 – 30 दिसम्बर 1968) नॉर्वीयन राजनीतिज्ञ, मजदूर नेता, सरकारी अधिकारी तथा लेखक थे। 1940 से 1945 तक उन्होने नॉर्वे के विदेश मंत्री के रूप में सेवा की। फ़रवरी 1946 से नवंबर 1952 तक वे संयुक्त राष्ट्र के महासचिव रहते हुये एक व्यावहारिक, निर्धारित राजनेता के रूप म...
null
null
null
null
Edit the following code to make it print out the sum of two numbers.
num1 = 10 num2 = 5 print(num1 * num2)
num1 = 10 num2 = 5 print(num1 + num2)
[DE Wikipedia] Stammzelltherapie beim Pferd Die Stammzelltherapie des Pferdes ist die Behandlung bestimmter Lahmheiten beim Pferd durch Injektion von Stammzellen. Keine der bisherigen präklinischen oder klinischen Studien zu dieser Therapieform haben bisher umfassende und nachhaltige Knorpelregeneration nachgewiesen. ...
null
null
null
null
In JavaScript construct a function to obtain the number of digits in an integer
function getNumOfDigits(num) { return num.toString().length; }
null
Create a Python class to represent a college student and its attributes.
class CollegeStudent: def __init__(self, name, age, major): self.name = name self.age = age self.major = major def get_name(self): return self.name def get_age(self): return self.age def get_major(self): return self.major
[DE Wikipedia] Palitzsch (Mondkrater) Palitzsch ist ein Einschlagkrater im Osten der Mondvorderseite, der unmittelbar am südöstlichen Rand des großen Kraters Petavius liegt. Der Krater ist stark erodiert und das Innere uneben. Nördlich des Kraters beginnt das Mondtal Vallis Palitzsch, das in nördlicher Richtung entlan...
null
null
null
null
What is the syntax for creating an array in JavaScript?
let myArray = [element1, element2, ...elementN];
[EN Wikipedia] Punakaiki River The Punakaiki River is a river of the West Coast Region of New Zealand's South Island. It flows predominantly northwest from its sources in the Paparoa Range, reaching the Tasman Sea two kilometres south of the town of Punakaiki. Most of the river's length is within Paparoa National Park...
null
null
null
null
Generate a two-dimensional array of random integers in JavaScript.
function generateRandomArray(rows, cols) { let array = []; for (let i=0; i < rows; i++) { array.push(Array.from({length: cols}, () => Math.floor(Math.random() * 10))); } return array; }
null
Create a TextBlob classifier in Python which takes in a string and outputs whether the sentiment of the string is positive or negative.
Not applicable
from textblob import TextBlob class SentimentClassifier: def classify(self, text): # Create TextBlob object analysis = TextBlob(text) # Set sentiment if analysis.sentiment[0]>0: return 'positive' elif analysis.sentiment[0]<0: return 'negative' else: return 'neutral'