text stringlengths 141 2.89k ⌀ | instruction stringlengths 19 1.5k ⌀ | input stringlengths 0 800 ⌀ | output stringlengths 1 2.5k ⌀ |
|---|---|---|---|
null | Create a method that given an array as input, outputs the quantity of odd numbers. | [1,2,3,4,5,6,7] | def countOdds(arr): return len([x for x in arr if x % 2 != 0]) |
null | Design a function in Python that takes in two numbers and outputs their sum. | 2, 3 | def sumTwo(a, b):
return a + b
print(sumTwo(2, 3)) |
[HI Wikipedia] आगा खां द्वितीय
अली शाह, आगा खां द्वितीय, मूल नाम अली शाह,47वां इमाम (अरवी : علي شاه، الآغا خان الثاني जन्म: 1885, जन्म स्थान : वर्तमान पुणे, भारत), शियाओं के निजरी इसमाईली मत के आध्यात्मिक नेता। ये आगा खां प्रथम के ज्येष्ठ पुत्र थे, शियाओं के निजारी इसमाईली संप्रदाय के इमाम या आध्यात्मिक नेता के रूप मे... | null | null | null |
[HI Wikipedia] चियापास
चियापास (स्पानी: Chiapas) आधिकारिक तौर पर स्वतंत्र और संप्रभु चियापास राज्य (स्पानी: Estado Libre y Soberano de Chiapas), मैक्सिको के 31 राज्यों में से एक है जिसमें संघीय जिले के साथ मैक्सिको की 32 संघीय संस्थायें शामिल है। यह 118 नगर पालिकाओं में विभाजित है और इसकी राजधानी टक्सत्ला गुतीएरेज़ है... | null | null | null |
[CS Wikipedia] Minoritský klášter (Znojmo)
Minoritský klášter je bývalý klášter ve Znojmě v ulici Přemyslovců. Klášter původně sloužil minoritům, následně františkánům a později sloužil jako vojenská vychovatelna nebo vězení; od roku 1945 pak slouží jako jedna z budov Jihomoravského muzea ve Znojmě. Klášter je spolu s... | null | null | null |
null | Create a Python function to check whether or not a string is palindrome or not. | def is_palindrome(string):
i = 0
j = len(string)-1
while j > i:
if string[i] != string[j]:
return False
i += 1
j -= 1
return True
# Driver code
string = "malayalam"
print(is_palindrome(string)) | |
null | Generate Python code that will update the values of a list | A list of integers lst = [5, 10, 10, 15, 25]. Update all values that are larger than 10 by subtracting 5. | lst = [x if x <= 10 else x - 5 for x in lst] |
[HI Wikipedia] गंगोत्री
गंगोत्री (Gangotri) भारत के उत्तराखण्ड राज्य के उत्तरकाशी ज़िले में स्थित एक नगर व प्रमुख हिन्दू तीर्थस्थल है। गंगोत्री नगर से 19 किमी दूर गोमुख है, जो गंगोत्री हिमानी का अन्तिम छोर है और गंगा नदी का उद्गम स्थान है। गंगा उद्गम गंगोत्री का गंगाजी मंदिर, समुद्र तल से 3042 मीटर की ऊँचाई पर स्थित ह... | null | null | null |
null | Develop a Python class for a student to be stored in a database. | class Student:
def __init__(self, name, age, grade, courses):
self.name = name
self.age = age
self.grade = grade
self.courses = courses
def enroll_in_course(self, course):
self.courses.append(course)
def get_grade(self):
return self.grade | |
null | Write a regular expression that matches words with an "r" followed by any number of letters. | \br[a-zA-Z]* | |
[DE Wikipedia] Bahnhof Bad Bellingen
Der Bahnhof Bad Bellingen ist neben dem Bahnhof Rheinweiler eine von zwei Bahnstationen in der baden-württembergischen Gemeinde Bad Bellingen im Landkreis Lörrach. Er besitzt zwei Bahnsteiggleise. Gemäß der Eisenbahn-Bau- und Betriebsordnung handelt es sich heute beim Bahnhof Bad B... | null | null | null |
[HI Wikipedia] डायक्रिया चतुष्कोण
डायक्रिया चतुष्कोण (Diacria quadrangle), संयुक्त राज्य भूगर्भ सर्वेक्षण (यूएसजीएस), खगोलभूविज्ञान अनुसंधान कार्यक्रम द्वारा इस्तेमाल के लिए मंगल ग्रह की 30 चतुष्कोणिय नक्शों की एक श्रृंखला में से एक है। डायक्रिया चतुष्कोण को MC-2(मार्स चार्ट-2) के रूप में भी जाना जाता है। खगोलशास्त्र ... | null | null | null |
[HI Wikipedia] केदैंऐ
केदैंऐ और केदैञै (Kėdainiai) यह एक नगर लिथुआनिया में है। वह नगर देश का मध्य में है, नेवेज़िस नदी के पास। केदैंऐ में लगभग ३०६६८ निवासी रहते हैं। लिथुआनिया शहर | null | null | null |
[DE Wikipedia] Josef Silberbauer
Joseph Silberbauer († 1805 in Znaim) war ein südmährischer Orgelbauer, der im letzten Drittel des 18. Jahrhunderts im nördlichen Niederösterreich und im südlichen Mähren wirkte. Dessen Nachfolger waren Ignaz Reinold und Benedikt Latzl, die jeweils den Betrieb in Znaim weiterführten. Le... | null | null | null |
null | Compare two strings in C# and return a Boolean indicating whether they are anagrams. | string1 = "listen"; string2 = "silent" | public static bool AreAnagrams(string string1, string string2) { if (String.Concat(string1.OrderBy(c => c)) == String.Concat(string2.OrderBy(c => c))) { return true; } else { return false; } } bool result = AreAnagrams("listen", "silent"); |
null | Create a class in Python called Math that can calculate the average of two numbers. | class Math: def __init__(self, x, y): self.x = x self.y = y def average(self): return (self.x + self.y) / 2 | |
null | Construct a for loop in the code for printing all items in the following list. | numbers = [1, 2, 3, 4] | numbers = [1, 2, 3, 4] for number in numbers: print(number) |
[HI Wikipedia] हरिराम व्यास
हरिराम व्यास (संवत १५६७ - १६८९) राधावल्लभ सम्प्रदाय के उच्च कोटि के भक्त तथा कवि थे। राघावल्लभीय संप्रदाय के हरित्रय में इनका विशिष्ट स्थान है। परिचय भक्तप्रवर व्यास जी का जन्म ओड़छानिवासी श्री सुमोखन शुक्ल के घर मार्गशीर्ष शुक्ला पंचमी, संवत् १५६७ को हुआ था। वे सनाढय शुक्ल ब्राह्मण थे। संस... | null | null | null |
null | Develop an algorithm for counting the number of unique characters in a string. | str = "Hello World!" | def uniqueChars(str): charCount = dict() for ch in str: if ch in charCount: charCount[ch] += 1 else: charCount[ch] = 1 return len(charCount) |
null | Write a Python program to generate a list that contains only the non-unique elements from a given list. | [1,2,3,4,5,1,2,2,3,4] | def generate_non_unique_list(lst): new_list = [] for i in lst: if lst.count(i) > 1 and i not in new_list: new_list.append(i) return new_list |
null | Find the index of the element "z" in the array "alphabet" below, and print the index. | let alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; | let index = alphabet.indexOf('z'); console.log(index); |
null | Decompose the following code into two different functions. | def calculateMinimumDifference(nums): if len(nums) <= 1: return 0 min_diff = float('inf') for x in range(1, len(nums)): min_diff = min(min_diff, abs(nums[x] - nums[x-1])) return min_diff | def calculate_diff(arr): return abs(arr[0] - arr[1]) def calculate_minimum_difference(nums): if len(nums) <= 1: return 0 min_diff = float('inf') for x in range(1, len(nums)): min_diff = min(min_diff, calculate_diff(nums[x-1:x+1])) return min_diff |
null | Write an algorithm to sort an array of integers in Python. | [2,1,3,4,6,5] | def bubble_sort(nums):
size = len(nums)
for i in range(size):
for j in range(size-1):
if nums[j] > nums[j+1]:
temp = nums[j]
nums[j] = nums[j+1]
nums[j+1] = temp
return nums
print(bubble_sort([2,1,3,4,6,5])) |
null | Calculate the percentage of numbers in an array that is greater than 5. | [3, 4, 7, 8, 9, 11] | def calc_perc(arr): count = 0 for num in arr: if num > 5: count +=1 return count/len(arr) *100 calc_perc([3, 4, 7, 8, 9, 11]) |
null | Generate a Python function that takes a list as input, and returns the number of values in the list that are greater than the average of the values in the list. | input_list = [4, 8, 6, 3, 10] | def count_above_average(input_list):
average = sum(input_list)/len(input_list)
count = 0
for value in input_list:
if value > average:
count += 1
return count |
[EN Wikipedia] Daniel Deusser
Daniel Deusser (; born 13 August 1981) is a German equestrian and Olympic bronze medalist. He represented his country at the 2016 Summer Olympics. He is nicknamed "Double D." His career reached a higher level starting from 2002, when he was part of team Germany at the Young Rider European... | null | null | null |
null | Program a binary search algorithm. | data: [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] target: 16 | def binary_search(data, target): low = 0 high = len(data) - 1 while low <= high: index = (low + high) // 2 value = data[index] if value == target: return index if target < value: high = index - 1 else: low = index + 1 return -1 data = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] target = 16 index = binary_search(data, target) ... |
null | Write a Python script to decrypt the given ciphertext. | Ciphertext: NPKUO | alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def decrypt(ciphertext):
plaintext = ""
for letter in ciphertext:
index = alphabet.find(letter)
newIndex = (index - 3) % 26
plaintext += alphabet[newIndex]
return plaintext
print(decrypt("NPKUO")) |
null | What is the maximum size of a virtual memory address used by 32-bit Intel 8086 processor? | The maximum size of a virtual memory address used by a 32-bit Intel 8086 processor is 4 gigabytes (2^32 bytes). | |
null | Create a python function that takes in two arguments x and y, and will print out the multiplication result after adding 1 to x. | def multiply_add_one(x, y):
print(x + 1 * y) | |
null | Create a function in Python that checks if a given number is a prime. | 15 | def isPrime(n):
if n < 2:
return False
for i in range(2, int(sqrt(n))+1):
if n % i == 0:
return False
return True |
null | What is a Hash Table in C++? | A Hash Table (also known as Hash Map) is a data structure in C++ which uses a hash function to map keys to values. It can be used to store, add, and remove elements in constant time and is often used for caches and associative arrays. | |
null | Write a JavaScript program to convert an array of objects into a comma-separated values (CSV) string with column headers. | [ {name: 'John', age: 28, city: 'New York'}, {name: 'Mary', age: 34, city: 'London'}, {name: 'Bob', age: 23, city: 'Los Angeles'} ] | function arrayToCSV(data) { let csv = ''; const headers = Object.keys(data[0]); csv += headers.join(',') + '\n'; data.forEach((item) => { let row = ''; Object.values(item).forEach((value) => { row += `"${value}",`; }); row = row.slice(0, -1); csv += `${row}\n`; }); return csv; } |
null | Develop a program to identify the highest number in a given array. | Array: [2, 5, 15, 4, 7, 10] | int highestNum = 0; foreach (int num in array) { if (num > highestNum) { highestNum = num; } } Console.WriteLine("The highest number in the array is " + highestNum); |
[CS Wikipedia] Náměstí republiky (Lublaň)
Náměstí republiky (slovinsky Trg republike), dříve náměstí revoluce (slovinsky Trg Revolucije) je jedno z hlavních náměstí v slovinské metropoli Lublani. Nachází se v jihozápadní části města, v blízkosti Plečnikova náměstí, Muzeálního náměstí a Národního muzea. Náměstí bylo na... | null | null | null |
null | Identify the most suitable language to create a web application. | JavaScript. | |
null | Write a python class to represent a circle | class Circle:
def __init__(self, radius):
self.radius = radius
def area(self):
return 3.14 * (self.radius ** 2)
def circumference(self):
return 2 * 3.14 * self.radius
circle1 = Circle(10)
print(circle1.area())
print(circle1.circumference()) | |
null | Generate a Python program to convert all characters to lowercase | def convert_to_lowercase(string):
return string.lower() | |
null | Create a loop to print the numbers in reverse order from 5 to 2. | for i in range(5, 1, -1): print(i) | |
[CS Wikipedia] Minerální olej
Minerální olej (též ropný olej) je jedním z produktů frakční destilace ropy. Je to průhledný, bezbarvý olej složený především z alkanů (typicky s 15 až 40 atomy uhlíku v molekule) a cyklických parafinů, příbuzný s vazelínou (známou též jako bílá vazelina, v lékopisu latinsky Vaselinum alb... | null | null | null |
null | Develop a python program to print the character with the maximum frequency in a given string. | sample_str = 'football' | def max_frequency_char(string):
char_freq = {}
for char in string:
if char in char_freq.keys():
char_freq[char] += 1
else:
char_freq[char] = 1
max_freq = 0
max_char = None
for char, freq in char_freq.items():
if freq > max_freq:
max_freq ... |
[DE Wikipedia] St. Laurentius (Bergstetten)
Die römisch-katholische, denkmalgeschützte Filialkirche St. Laurentius steht in Bergstetten, einem Ortsteil des Marktes Laaber im Landkreis Regensburg der Oberpfalz. Die Kirche gehört zum Bistum Regensburg. Das Bauwerk ist unter der Denkmalnummer D-3-75-162-28 als Baudenkmal... | null | null | null |
null | Create a HTML form which includes a dropdown list and a submit button. | <form> <select> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </select> <input type="submit" value="Submit"> </form> | |
null | Build an algorithm in Python that creates output based on the given input. | Input: [1, 2, 5, 8, 11] | def algorithm(input_list):
output_list = []
for i in input_list:
if i % 2 == 0:
output_list.append(str(i) + ' is an even number')
else:
output_list.append(str(i) + ' is an odd number')
return output_list |
[HI Wikipedia] रवांडा जनसंहार
रवांडा नरसंहार तुत्सी और हुतु समुदाय के लोगों के बीच हुआ एक जातीय संघर्ष था। 1994 में 6 अप्रैल को किगली में हवाई जहाज पर बोर्डिंग के दौरान रवांडा के राष्ट्रपति हेबिअरिमाना और बुरुन्डियान के राष्ट्रपति सिप्रेन की हत्या कर दी गई, जिसके बाद ये संहार शुरू हुआ। करीब 100 दिनों तक चले इस नरसंहार... | null | null | null |
[HI Wikipedia] शुमश्ती भाषा
शुमश्ती (Shumashti, ), जिसे शुमश्त भी कहते हैं, कुनर (कुनड़) शाखा की एक दार्दी भाषा है जो अफ़ग़ानिस्तान के कुनर प्रान्त में बोली जाती है। यह कुनर नदी के पश्चिमी किनारे पर ग्वार-बती बोलने वाले इलाक़े से लगभग ६० किमी दूर बोली जाती है। १९९४ में अनुमान लगाया गया कि इसे केवल १,००० लोग बोलते हैं... | null | null | null |
[DE Wikipedia] Amar Ouamrane
Amar Ouamrane (* 1919 in Frikat, Französisch-Algerien; † 28. Juli 1992 in Algier, Algerien) war während des Algerienkriegs Offizier des bewaffneten Arms der Front de Libération Nationale sowie Vertreter der Organisation im Ausland. Leben Ouamrane wurde in Frikat in der Region Tizi Ouzou al... | null | null | null |
null | Enter the necessary code to initiate a MongoDB connection | from pymongo import MongoClient #creating the MongoClient client = MongoClient("mongodb://localhost:27017/") #connecting to the database db = client["database_name"] | |
null | Generate a random string containing only lowercase letters using Python. | import string
import random
def gen_random_string(length):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(length))
print(gen_random_string(10)) | |
null | Provide an example of an if-else statement in C++. | int x = 5; if (x > 0) { std::cout << "x is positive"; } else { std::cout << "x is negative or zero"; } | |
null | Create an algorithm in Python for removing all duplicates from an array. | arr = [1, 2, 4, 4, 1, 5, 2] | def removeDuplicates(arr):
res = []
seen = set()
for e in arr:
if e not in seen:
res.append(e)
seen.add(e)
return res
print(removeDuplicates([1, 2, 4, 4, 1, 5, 2])) |
[DE Wikipedia] Georg Streiter (Journalist, 1907)
Georg Heinrich Karl Streiter (* 20. Oktober 1907 in Berlin; † 9. August 1976 in Bonn) war ein deutscher Journalist und Politiker. Studium in Berlin und Danzig Georg Streiter studierte von 1926 bis 1929 Nationalökonomie an der Friedrich-Wilhelms-Universität zu Berlin, wo... | null | null | null |
null | Develop a python program to find the maximum element in a dictionary | sampleDict = {'A': 12, 'B': 17, 'C': 3} | def findMax(sampleDict):
max_value = 0
max_key = ''
for key, value in sampleDict.items():
if value > max_value:
max_value = value
max_key = key
return max_key, max_value
# Driver's code
sampleDict = {'A': 12, 'B': 17, 'C': 3}
max_key, max_value = fi... |
null | Create a MySQL table with two columns id and name, where id should have primary key. | CREATE TABLE student ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, PRIMARY KEY (id) ); | |
null | Write code to convert a given hexadecimal string to a binary string. | Hexadecimal string: 7468 | def hex_to_bin(hexadecimal_str): return bin(int(hexadecimal_str, 16))[2:] # [2:] removes 0b from the start |
null | Construct a switch-case statement in JavaScript to print the day of the week. | var day_index = 5; | switch (day_index) { case 0: console.log('Monday'); break; case 1: console.log('Tuesday'); break; case 2: console.log('Wednesday'); break; case 3: console.log('Thursday'); break; case 4: console.log('Friday'); break; case 5: console.log('Saturday'); break; case 6: console.log('Sunday'); break; } |
null | Write a Python program to find all pairs of numbers in the given list whose sum is equal to the given number. | nums = [1, 2, 3, 4, 5], sum = 8 | def find_pairs(nums, sum): result = [] for i in range(len(nums)): for j in range(i+1, len(nums)): if nums[i] + nums[j] == sum: result.append((nums[i], nums[j])) return result res = find_pairs(nums, sum) print(res) # Output: [(2, 6), (3, 5)] |
null | Rewrite the code below to use Python data structures. | let numbersArray = [5, 9, 3, 2, 6, 10];
let numbersArrayIndex = 0;
let currentNumber = numbersArray[numbersArrayIndex];
while (numbersArrayIndex < numbersArray.length) {
console.log(currentNumber);
numbersArrayIndex++;
currentNumber = numbersArray[numbersArrayIndex];
} | numbers_array = [5, 9, 3, 2, 6, 10]
for current_number in numbers_array:
print(current_number) |
null | Write a Scala function to generate a range of numbers. | def generateRange(start:Int, end:Int): List[Int] = { if (start > end) List(end) else start :: generateRange(start+1, end) } | |
null | Write a Python program to calculate the sum of all words in a sentence. | def sum_of_words(sentence):
words = sentence.split()
total = 0
for word in words:
total += len(word)
return total
result = sum_of_words("This is a sentence")
print(result) | |
null | Scale a vector of 10 numbers from 0 to 10. | [2.5, 3.5, 5.5, 7.5, 1.5, 8.5, 0.5, 4.5, 6.5, 9.5] | def scale(vector): scaled_vector = [] for i in vector: scaled_vector.append(i/10*10) return scaled_vector |
null | Create a JavaScript statement that generates a random number between 1 and 10. | Math.floor(Math.random() * 10) + 1; | |
[HI Wikipedia] आगा खां तृतीय
सुल्तान सर मुहम्मद शाह, आगा खां तृतीय, मूल नाम : सुल्तान सर मुहम्मद शाह,48वां इमाम (अरवी : سيدي سلطان محمد شاه، الآغاخان الثالث जन्म:2 नवम्बर 1877, जन्म स्थान : वर्तमान कराची, पाकिस्तान, मृत्यु : 11 जुलाई 1957, वरसोई, स्विट्जरलैंड), शियाओं के निजरी इसमाईली मत के आध्यात्मिक नेता। ये आगा खान... | null | null | null |
[EN Wikipedia] Teviot River
The Teviot River is a river in New Zealand, a tributary of the Clutha River. See also List of rivers of New Zealand References Rivers of Otago Rivers of New Zealand Tributaries of the Clutha River | null | null | null |
null | Write a JavaScript function that multiplies two numbers together. | function multiply(x, y) { return x * y; } | |
null | Classify the following snippet of Python code as data wrangling, visualization, or machine learning. | from sklearn.neighbors import KNeighborsClassifier
knn = KNeighborsClassifier(n_neighbors=5)
knn.fit(X, y) | Machine learning. |
null | Modify the following Python script to create a new object 'obj2' that has the same data as 'obj1', but with the 'val2' value changed to 100. | obj1 = {'key1': 'val1', 'key2': 'val2'} | obj1 = {'key1': 'val1', 'key2': 'val2'}
# create a copy of obj1
obj2 = obj1.copy()
# modify the value of key2
obj2['key2'] = 100 |
null | How can you detect if there is an infinite loop in a code? | One way of detecting if there is an infinite loop in a code is by using a counter to count the number of iterations the loop is performing. If the number of iterations exceeds some predefined threshold value, we can conclude that the code is executing an infinite loop. Another technique to detect an infinite loop is to... | |
null | Create a Ruby program that takes a group of strings and returns the number of strings longer than 5 characters. | ["Hello", "World", "Foo", "Bar", "Baz"] | strings = ["Hello", "World", "Foo", "Bar", "Baz"] count = 0 strings.each do |str| if str.length > 5 count += 1 end end puts "The number of strings longer than 5 characters is: #{count}" |
null | Create a function in Python that takes two parameters: a list of numbers and an integer, and returns the list of numbers sorted such that any numbers divisible by the integer are placed at the beginning of the list. | numbers = [10, 7, 3, 9, 12, 15]
integer = 3 | def sortByDivisible(numbers, integer):
sortedList = []
for num in numbers:
if (num % integer == 0):
sortedList.append(num)
for num in numbers:
if (num % integer != 0):
sortedList.append(num)
return sortedList
numbers = [10, 7, 3, 9, 12, 15]
integer = 3
print(sortByDivisible(numbers, integer))
# Output: [9,... |
null | Write a lambda expression to find the maximum value of two numbers. | maximum = lambda num1, num2: num1 if num1 > num2 else num2 | |
null | Write a Python function to invert a string (swap uppercase and lowercase letters). | def invert_string(string):
# Initially create an empty string as result
result = ''
# Traverse every character of the string
for char in string:
# If an uppercase character is found
if char.isupper():
# Add its lowercase equivalent to the result
result ... | |
null | Edit an existing Python script to search for and delete duplicated words in a string. | my_string = 'this this string contains contains duplicate duplicate words words' | my_string = 'this string contains duplicate words'
my_string = my_string.split()
res = []
for i in my_string:
if i not in res:
res.append(i)
my_string = ' '.join(res)
print(my_string) |
[DE Wikipedia] Bruton Music
Bruton Music ist ein britisches Musiklabel, welches im Jahre 1977 vom Musikproduzenten Robin Phillips gegründet wurde. Das Label veröffentlichte vorwiegend instrumentale, gesangslose Titel, welche häufig in TV-Serien und -Filmen Einsatz fanden. Es wechselte 1982 erstmals den Besitzer, als M... | null | null | null |
[DE Wikipedia] Ramsler (Malerfamilie)
Die Malerfamilie Ramsler geht auf den niederländischen Steinhauer Gerhard Ramsler aus Deventer zurück. Sein gleichnamiger Sohn verließ wegen religiöser Verfolgung um 1560 seine niederländische Heimat und ließ sich in Straubing nieder. Das Schicksal der Familie lässt sich bis zur M... | null | null | null |
[HI Wikipedia] प्राग
प्राग (चेक: प्राहा; जर्मन: प्राग; ) चेक गणराज्य की राजधानी और सबसे बड़ा शहर है। यह यूरोपीय संघ का 14वां सबसे बड़ा शहर है। प्राग कभी बोहेमिया की ऐतिहासिक राजधानी हुआ करती थी। वल्टावा नदी के उत्तर-पश्चिम में स्थित यह शहर 1.3 मिलियन लोगों का घर है, जबकि इसके महानगरीय क्षेत्र की 2.6 लाख की आबादी होने ... | null | null | null |
null | Find the sum of all elements from the following list. | list1 = [1, 2, 3, 4, 5] | list_sum = 0 for num in list1: list_sum += num print(list_sum) # Output: 15 |
null | Develop an algorithm in Python for sorting the given array in increasing order | [5, 4, 3, 2, 1] | def bubbleSort(arr):
n = len(arr)
# Traverse through all array elements
for i in range(n):
# Last i elements are already in place
for j in range(0, n-i-1):
# traverse the array from 0 to n-i-1
# Swap if the element found is greater
# than ... |
null | Design a C++ program to convert a given number from binary to decimal. | <<noinput>> | #include<iostream> #include<math.h> int BinToDec(long long n) { int decimalNumber = 0, i = 0, remainder; while (n!=0) { remainder = n % 10; n /= 10; decimalNumber += remainder*pow(2,i); ++i; } return decimalNumber; } int main() { long long bNum; std::cout << "Enter a binary number: "; std::cin >> bNum; int dec = BinToD... |
null | Write a python program to check if two given strings are anagrams. Anagrams are two strings which contain the same set of characters. | s1 = "cat", s2 = "tac" | def is_anagram(s1, s2):
s1 = s1.lower()
s2 = s2.lower()
if len(s1) != len(s2):
return False
s1_dict = {}
for char in s1:
if char not in s1_dict:
s1_dict[char] = 1
else:
s1_dict[char] += 1
for char in s2:
if char not in s1_dict:
... |
null | Design a function in Python to count the total number of prime numbers between the two given numbers (inclusive). | Start = 10, End = 20 | def count_primes(start, end):
count = 0
for i in range(start, end+1):
if is_prime(i):
count += 1
return count
def is_prime(num):
for i in range(2, int(num**0.5) + 1):
if num % i == 0:
return False
return True |
null | Write a function to filter a list of strings based on a search term | def filter_by_search_term(strings, search_term): return [string for string in strings if search_term in string] | |
null | Find the largest integer in this list? | [1, 4, 9, 3, 5] | largest_integer = max([1, 4, 9, 3, 5]) print(largest_integer) # Output: 9 |
null | Suggest a solution to improve the following Python code to minimize the running time. | def reverse_list(input_list):
rev_list = []
for i in range(len(input_list)-1,-1,-1):
rev_list.append(input_list[i])
return rev_list | def reverse_list(input_list):
left = 0
right = len(input_list) - 1
while left < right:
input_list[left], input_list[right] = input_list[right], input_list[left]
left += 1
right -= 1
return input_list |
[HI Wikipedia] जनकपुर
जनकपुर नेपाल का प्रसिद्ध धार्मिक स्थल है ये नगर प्राचीन काल में मिथिला की राजधानी माना जाता है। यहाँ पर प्रसिद्ध राजा जनक थे। जो सीता माता के पिता थे। यह शहर भगवान राम की ससुराल के रूप में विख्यात है। वर्तमान स्थिति जनकपुर संप्रति नेपाल के जनकपुर अंचल और धनुषा जिला में स्थित है। भाषा-बोली यहाँ की... | null | null | null |
null | Create a function that filters an array for all numbers greater than the given number. | def filter_array(arr, num): return [x for x in arr if x > num] | |
null | Create a css class to set the text color of a h1 element to blue. | h1 { color: blue; } | |
null | given a sentence, Write a JavaScript program to find out whether the sentence contains all the vowels. | let sentence = "This is an example sentence"; | function findVowels(sentence) { let count = 0; let vowels = "aeiou"; for (let char of sentence.toLowerCase()) { if (vowels.indexOf(char) !== -1) { count++; } } return count === 5; } |
null | Write a regular expression that finds all the words in a given sentence that start with a lowercase letter. | Sentence: Hello World. | \b[a-z]\w+\b |
null | Create an HTML page to display the output of a JavaScript greeting message. | message: Welcome! | <!DOCTYPE html> <html> <head> <title>JavaScript Greeting Message</title> </head> <body> <h1>Welcome!</h1> <script type="text/javascript"> document.write("Welcome!"); </script> </body> </html> |
null | Alter the following python code such that it prints "Hello, world!" | for x in range(1,10): print(x) | for x in range(1,10): if x == 5: print('Hello, world!') else: print(x) |
[HI Wikipedia] थायलेसीन
थायलेसीन (Thylacine) आधुनिक युग का सबसे ज्ञात मांसाहारी धानीप्राणी (मारसूपियल) था। इसे अपनी पीठ की धारियों के कारण तस्मानियाई शेर (Tasmanian tiger) भी कहा जाता है। कुछ लोग इस तस्मानियाई भेड़िया (Tasmanian wolf) भी बुलाते हैं। यह ऑस्ट्रेलिया की मुख्यभूमि, तस्मानिया द्वीप और न्यू गिनी का निवास... | null | null | null |
null | Given a list of strings, write a Python function to remove all the whitespaces from each string. | ['Hello World ', 'Hi there', 'Good Morning'] | def remove_whitespace(word_list):
return [word.strip() for word in word_list]
stripped_list = remove_whitespace(['Hello World ', 'Hi there', 'Good Morning'])
print(stripped_list) |
null | Rewrite the following C++ function to Python. | int multiply(int a, int b)
{
int result = a * b;
return result;
} | def multiply(a, b):
result = a * b
return result |
null | Write a Python function to calculate the greatest common factor (GCF) of two numbers. | Number 1: 15
Number 2: 25 | def gcf(m, n):
while m != 0:
m, n = n % m, m
return n
print(gcf(15, 25)) |
null | Implement a function in Python to reverse a given list of numbers. | List: [1, 2, 4, 7, 9] | def reverseList(list):
start = 0
end = len(list) - 1
while start < end:
list[start], list[end] = list[end], list[start]
start += 1
end -= 1
return list
list = [1, 2, 4, 7, 9]
reverseList(list)
# Output: [9, 7, 4, 2, 1] |
null | Create a new list 'squared' that contains the squares of all the elements in the list 'nums'. | nums = [1, 2, 3, 4] | squared = [num**2 for num in nums] |
[DE Wikipedia] Michael Kotulla
Michael Kotulla (* 19. Juni 1960 in Hannover) ist ein deutscher Rechtswissenschaftler und Hochschullehrer. Leben Kotulla verließ 1976 die Hauptschule und machte bis 1979 eine Berufsausbildung zum Kfz-Mechaniker. Im Anschluss daran besuchte er zunächst 1979/1980 eine Berufsfachschule und ... | null | null | null |
null | Query an SQL table called "Students" to get the names of all the enrolled students. | SELECT Name FROM Students; | |
null | Create a python function for calculating the area of a circle given the radius. | def area(radius):
return 3.14 * radius * radius |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.