text stringlengths 141 2.89k ⌀ | instruction stringlengths 19 1.5k ⌀ | input stringlengths 0 800 ⌀ | output stringlengths 1 2.5k ⌀ |
|---|---|---|---|
null | Edit the following Python code to re-rank the numbers in descending order. | numbers = [4, 7, 2, 3] | numbers = [4, 7, 2, 3]
numbers.sort(reverse=True)
print(numbers) |
null | Create an HTML element, a div with an ID of "content". | <div id="content"></div> | |
null | Convert this Python data structure into a valid JSON string. | data = { "key1" : [1,2,3], "key2" : { 'subkey1' : True, 'subkey2' : 'Hello World' } } | json_string = json.dumps(data) |
null | Generate all possible strings of length n using A, B and C | 3 | ['AAA', 'AAB', 'AAC', 'ABA', 'ABB', 'ABC', 'ACA', 'ACB', 'ACC', 'BAA', 'BAB', 'BAC', 'BBA', 'BBB', 'BBC', 'BCA', 'BCB', 'BCC', 'CAA', 'CAB', 'CAC', 'CBA', 'CBB', 'CBC', 'CCA', 'CCB', 'CCC'] |
null | Create a SQL query to find the 3 oldest employees in the 'employees' table. | SELECT * FROM employees ORDER BY date_of_birth LIMIT 3; | |
null | What is a use case for the switch statement in C++? | A switch statement in C++ is used to execute a statement or group of statements for a given value. This is particularly useful when dealing with a large number of cases. The switch statement evaluates an expression and compares the result with different case labels, and executes the code associated with the matching ca... | |
null | Create a function which determines if a given number is a palindrome. | 7337 | def palindrome(num): # convert the number to a string num_str = str(num) # Reverse the string using slicing rev_str = num_str[::-1] # check if the given number is equal to the reversed string if num_str == rev_str: return True else: return False if __name__ == "__main__": num = 7337 print(palindrome(num)) |
null | Write a regular expression that extracts all numbers from the given text. | Text: "The total number of students is 50 and the average score is 78 out of 100." | \d+ |
null | How many islands of Scotland are there? | There are over 700 islands in Scotland, with approximately 150 of them being inhabited. | |
[EN Wikipedia] Anatol Grinţescu
Anatol Grinţescu (1 August 1939 – 2 June 2014) was a Romanian water polo player. He competed at the 1960 Summer Olympics and the 1964 Summer Olympics. References External links 1939 births 2014 deaths Romanian male water polo players Olympic water polo players for Romania Water polo pla... | null | null | null |
[DE Wikipedia] Andrea de’ Bartoli
Andrea de’ Bartoli (oder Andrea da Bologna) (* 1349 in Bologna; † 1369) war ein italienischer Maler. Nach Meinung der Kunstkritiker R. Longhi (1934/35) und Francesco Arcangeli (1971) arbeitete Andrea de’ Bartoli im Stil des Vitale da Bologna und war daher vermutlich dessen Schüler. Di... | null | null | null |
null | Write a Python program to fliter a list of strings and return a new list containing only the strings containing the letter 'a'. | ['ant', 'bar', 'cat', 'dog', 'eel'] | list_strings = ['ant', 'bar', 'cat', 'dog', 'eel']
# using list comprehension
filtered_list = [x for x in list_strings if 'a' in x]
print(filtered_list)
# output: ['ant', 'bar', 'cat'] |
null | Create a matrix in R and fill it with random numbers. | Size: 4 x 5 | matrix2 <- matrix(runif(n = 20, min = 0, max = 10), nrow = 4, ncol = 5) |
null | Create a randomized password of 10 characters. | F8a_3q4*f2 | |
[DE Wikipedia] Kurt von Buchau
Freiherr Hans Kurt Wilhelm Prinz von Buchau (* 25. April 1863 in Neisse; † 29. Mai 1918 bei Cierges, Frankreich) war ein preußischer Generalmajor. Leben Herkunft Kurt entstammte dem 2. Ast (Nieder-Kühschmalz) der I. Linie des Adelsgeschlechts Prinz von Buchau. Er war der jüngste Sohn des... | null | null | null |
null | Create a k-means clustering algorithm in Python to cluster a given dataset. | from sklearn.cluster import KMeans
def k_means_clustering(data, num_clusters):
kmeans = KMeans(n_clusters=num_clusters, random_state=0).fit(data)
labels = kmeans.labels_
return labels | |
[HI Wikipedia] कश्मीर
काश्मीर (कश्मीरी : (नस्तालीक़), कऺशीर (देवनागरी)) जम्मू - कश्मीर का उत्तरी भौगोलिक क्षेत्र है। 1846 में, पहले एंग्लो-सिख युद्ध में सिख की हार के बाद, और अमृतसर की सन्धि के तहत ब्रिटिश से क्षेत्र की खरीद पर, जम्मू के राजा, गुलाब सिंह, कश्मीर के नए शासक बने। उनके वंशजों का शासन, ब्रिटिश क्राउन की स... | null | null | null |
null | Create a function in Python that takes a string as an argument and capitalizes the first letter of each word. | String s = "hello world" | def capitalize(s):
return ' '.join(w.capitalize() for w in s.split()) |
null | Create a function in Python that takes two dates as parameters and calculates the number of days between them. | def date_difference(date1, date2):
diff = date2 - date1
return diff.days | |
null | Design a SQL query to retrieve data from multiple tables. | SELECT t1.col1, t1.col2, t2.col1, t2.col2 FROM table1 t1 INNER JOIN table2 t2 ON t1.col1 = t2.col1 | |
[HI Wikipedia] हैमिल्टन, न्यूज़ीलैण्ड
हैमिल्टन न्यूज़ीलैण्ड के चौथे सबसे बड़े नगरीय क्षेत्र हैमिल्टन नगरीय क्षेत्र के केंद्र में स्थित है। हैमिल्टन शहर देश का चौथा सबसे बड़ा प्रादेशिक प्राधिकरण है। यह उत्तर द्वीप के वाइकाटो क्षेत्र में है, ऑक्लैण्ड से लगभग 130 किलोमीटर (80 मील) दक्षिण में। शुरुआत में यह कृषि सेवा केन्... | null | null | null |
[DE Wikipedia] Flinderskette
Die Flinderskette () ist ein Gebirgszug im Norden des australischen Bundesstaates South Australia (Südaustralien), der sich fast 500 km in nordsüdliche Richtung erstreckt. In dieser Region liegen drei Nationalparks: Mount-Remarkable-Nationalpark im Süden, den Vulkathunha-Gammon-Ranges-Nati... | null | null | null |
null | What is the significance of include guard in C++? | Include guards are used to prevent multiple declarations of the same header file. They are typically used to ensure that a header file is included only once in a project. This helps to avoid potential conflicts between different declarations of the same header file in different places. | |
[DE Wikipedia] Lars Charbonnier
Lars Charbonnier (* 21. November 1977 in Uelzen) ist ein deutscher evangelischer Theologe. Leben Nach seinem Studium der Evangelischen Theologie und Soziologie in Bethel, Heidelberg, Nijmegen (NL) und Berlin arbeitete er von 2006 bis 2014 als Wissenschaftlicher Assistent am Lehrstuhl fü... | null | null | null |
null | Write a predicate function to check whether the given string is palindrome. | function isPalindrome(str) { str = str.toLowerCase(); for (let i = 0; i < str.length / 2; i++) { if (str[i] !== str[str.length - 1 - i]) return false; } return true; } | |
null | How would you design the data structure to store and process results from a 5-choice multiple choice test. | class TestResults { // A map containing the question id as key and the selected answer as value Map<Integer, Integer> answers; // A map containing the question id as key and a boolean indicating whether the answer was correct or not as value Map<Integer, Boolean> scores; // A map containing the question id as key and a... | |
null | Design a python program to generate a binary tree | class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
class BinaryTree:
def __init__(self):
self.root = None
def insert(self, data):
new_node = Node(data)
if self.root is None:
self.root = new_node
else... | |
null | Parse the following HTML code to get all the hyperlinks in the page. | <a href="https://example.com/about">About</a> <a href="https://example.com/products">Products</a> | import re html_code = ''' <a href="https://example.com/about">About</a> <a href="https://example.com/products">Products</a> ''' links = re.findall(r'href="(.*?)"', html_code) print(links) # Output: ['https://example.com/about', 'https://example.com/products'] |
null | Create a basic program to demonstrate a conditional statement | num = int(input("Please enter a number: ")) if (num % 2) == 0: print("The number is even") else: print("The number is odd") | |
null | Wrap the given text in a tag. | Hello World | <p>Hello World</p> |
[HI Wikipedia] मंगल के चतुष्कोणों की सूची
मंगल ग्रह के भूपृष्ठ को संयुक्त राज्य भूगर्भ सर्वेक्षण द्वारा 30 चतुष्कोणों में विभाजित किया गया है, ऐसा नाम इसलिए क्योंकि उनकी सीमाएं अक्षांश और देशांतर रेखाओं के साथ-साथ स्थित है, इसलिए नक्शे आयताकार दिखाई देते हैं। मंगल चतुष्कोणों के नाम स्थानीय भूआकृतियों पर रखे गए है, और ... | null | null | null |
null | Calculate the total surface area of a rectangular prism with length 10 cm, width 8 cm, and height 5 cm. | Total surface area of a rectangular prism = 2(lw + lh + wh) = 2(10 x 8 + 10 x 5 + 8 x 5) = 2(80 + 50 + 40) = 220 cm2 | |
null | Implement a basic version control system in Python that keeps track of changes in the code. | class VersionControl:
def __init__(self, lines):
self.lines = lines
self.mark = 0
def commit(self):
self.mark += 1
log_file = open("log_file.txt", "a+")
log_file.write(str(self.mark) + ": " + str(self.lines))
log_file.close()
def restore(self):
log... | |
null | Create a Python function to remove all the characters of a specified string that appear more than once. | def remove_duplicates(string):
result = ""
for char in string:
if string.count(char) == 1:
result += char
return result | |
null | Write a SQL query to find all students who have a GPA greater than 3.0 | SELECT * FROM students WHERE GPA > 3.0 | |
[HI Wikipedia] निकोलो द कोंटी
निकोलो दे कोंटी (1395-1474) एक इतालवी देशाटक और अन्वेषी था जो मध्य युग में मुस्लिम व्यापारी के वेष में इटली से लेकर भारत, दक्षिण-पूर्व एशिया और संभवतः चीन तक का भ्रमण किया। ध्यान रहे कि इन देशों और इटली के बीच उस समय मुस्लिम शासकों का राज था (और आज भी है) और ईसाईयों का इस प्रदेश से होकर ग... | null | null | null |
null | Re-structure the following code so that it can be written using a for loop in Python. | i = 1
while i < 5:
print(i)
i += 1 | for i in range(1, 5):
print(i) |
null | Produce an algorithm to reverse the elements of an array. | Array: [1, 2, 3, 4, 5] | Algorithm: // Step 1: Set two pointers, start and end initially pointing to 0 and the last element respectively. start = 0; end = arr.length - 1; // Step 2: Swap the elements at pointer start and end. swap(arr[start], arr[end]); // Step 3: Increment start pointer and decrement end pointer. start++; end--; // Step 4: Re... |
[CS Wikipedia] Boeing C-137 Stratoliner
Boeing C-137 Stratoliner je VIP transportní letoun odvozený z dopravního letounu Boeing 707, používaný americkým letectvem. Ostatní státy také pořídily jak nové, tak i použité Boeingy 707 pro vojenskou službu, především jako VIP letouny nebo létající cisterny. Navíc model 707 po... | null | null | null |
null | Implement a solution to mark the middle element in a singly linked list in Python. | Not applicable | class Node:
def __init__(self, data):
self.data = data
self.next = None
class SinglyLinkedList:
def __init__(self):
self.head = None
self.tail = None
self.middle = None
def addNode(self, node):
if self.head is None:
self.head = node
self.tail = node
self.middle = node
else:
self.tail.next... |
[EN Wikipedia] List of Liverpool Docks
Table of docks (past and present) in the Port of Liverpool, Liverpool, England. The table can be sorted on each of its columns by clicking the small box in the header. The sequence runs from North (N01) to South (S19). (Using references: .) References External links Port of Liver... | null | null | null |
null | So you need to design a class for a Linked List. | class ListNode: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def is_empty(self): return self.head == None # Other method implementations go here | |
null | Write a function to convert a Roman numeral to an integer. | def roman_to_integer(numeral): romans = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000 } num = 0 i = 0 while i < len(numeral): if i+1 < len(numeral): if romans[numeral[i]] >= romans[numeral[i+1]]: num = num + romans[numeral[i]] else : num = num + romans[numeral[i+1]] - romans[numeral[i]] i+=1 else: nu... | |
[DE Wikipedia] Hase (Mondkrater)
Hase ist ein Einschlagkrater im Osten der Mondvorderseite, südöstlich des Mare Fecunditatis, südlich des Kraters Petavius und östlich von Snellius. Der stark erodierte Krater wird in seinem südlichen Teil von dem großen Nebenkrater Hase D überlagert. Beginnend südlich von Hase verläuft... | null | null | null |
[DE Wikipedia] Liste der Monuments historiques in Mathons
Die Liste der Monuments historiques in Mathons führt die Monuments historiques in der französischen Gemeinde Mathons auf. Liste der Immobilien |} Liste der Objekte |} Weblinks Mathons Mathons ! | null | null | null |
null | Construct a program to parse a JSON array. | [{"name":"John", "age":30},{"name":"Alice", "age":25}] | import json data = [{"name":"John", "age":30},{"name":"Alice", "age":25}] for entry in data: name = entry['name'] age = entry['age'] print(f'The name is {name} and age is {age}') |
null | Using HTML and CSS, create a web page that lists all of the fruits in the given array. | fruits = ["apple", "orange", "banana", "pear", "mango"] | <html> <head> <title>Fruit List</title> </head> <body> <ul> <li>Apple</li> <li>Orange</li> <li>Banana</li> <li>Pear</li> <li>Mango</li> </ul> </body> </html> |
[DE Wikipedia] John Kirkbride
John Kirkbride ist der Name folgender Personen: * John Kirkbride (Musiker) (* 1946), britischer Sänger, Gitarrist und Songwriter John Kirkbride (Leichtathlet) (* 1947), britischer Mittelstreckenläufer | null | null | null |
[HI Wikipedia] किशोरी आमोनकर
किशोरी आमोनकर (जन्म: 10 अप्रैल, 1931) (मृत्यु :3 अप्रेल 2017 - 84 वर्ष) हिंदुस्तानी संगीत की विख्यात गायिका थीं जिनका सम्बन्ध अतरौली जयपुर घराने से हैं। इनकी माता श्रीमती मोगुबाई कुर्डीकर भी इसी घराने की मशहूर शास्त्रीय गायिका थीं।। इनको[पद्म विभूषण]] से सम्मनित किया गया है। सन्दर्भ बाहरी ... | null | null | null |
null | Create a HTML page to display information about a group of users. | User details: John – Age: 24, Profession: Developer Mark – Age: 26, Profession: Designer | <html> <head> </head> <body> <h1>User Details</h1> <p>John – Age: 24, Profession: Developer</p> <p>Mark – Age: 26, Profession: Designer</p> </body> </html> |
null | Create a web page using HTML and CSS where the font size of the content increases with the screen size. | <!DOCTYPE html> <html> <head> <style> h1{ font-size: 1.5em; } @media only screen and (min-width: 600px) { h1 { font-size: 2em; } } @media only screen and (min-width: 900px) { h1 { font-size: 2.5em; } } </style> </head> <body> <h1>My Title</h1> </body> </html> | |
null | Create a function to scale a number by the given factor. | factor = 0.5 | def scale_value(x, factor): '''This function will scale the given number by the given factor.''' return x * factor |
[DE Wikipedia] La Reina del Sur
La Reina del Sur steht für: La Reina del Sur (dt. Königin des Südens (Roman)), spanischer Roman (2002) von Arturo Pérez-Reverte La Reina del Sur, Album (2002) von Los Tigres del Norte La Reina del Sur (Telenovela) (2011) Siehe auch: Queen of the South Queen of the South (Fernsehserie) K... | null | null | null |
[DE Wikipedia] Johann Adam Hoffmann
Johann Adam Hoffmann (* 7. Mai 1707 in Schönfeld, Fürstentum Schwarzburg; † 7. Januar 1781 in Herborn) war ein deutscher Mediziner und Botaniker. Leben Johann Adam Hoffmann war der Sohn eines in Schönfeld im Schwarzburgischen tätigen Apothekers, dem er den ersten Unterricht verdankt... | null | null | null |
null | Write a Java program to sort the following array of integers using Quick Sort. | int arr[] = {4, 3, 6, 2, 5, 1}; | public class QuickSort { // Method to implement quick sort public static void quickSort(int[] arr, int low, int high) { if (low < high) { /* pi is partitioning index, arr[pi] is now at right place */ int pi = partition(arr, low, high); // Recursively sort elements before // partition and after partition quickSort(arr, ... |
[DE Wikipedia] Sachsen Bay
Die Sachsen Bay (in der deutschen Kolonialzeit Sachsenbucht genannt) ist eine Bucht an der Südküste des Huongolfs im Süden der Provinz Morobe von Papua-Neuguinea. Sie ist damit Teil der Salomonensee. Allgemeines Die Bucht wird durch einen Einschnitt in das Kernland Papuas gebildet, ist etwa ... | null | null | null |
null | Implement a Python function that will take two strings and return true if the first string contains the second. | query = "catering"
word = "cat" | def check_contains(query, word):
if query.find(word) != -1:
return True
return False
result = check_contains(query, word) |
null | Build a function in Python for computing the Hamming Distance between two strings of equal length. | String 1: python
String 2: perl | def hammingDistance(s1, s2):
# initialize with 0
distance = 0
# Calculate the length of the string
length_str1 = len(s1)
# Compare adjacent characters and increment the count
# if characters are not same
for i in range(length_str1):
if s1[i] != s2[i]:
distance ... |
null | Suggest a faster way to get a sublist from a given list. | A faster way to get a sublist from a given list is to use slicing. For example, to get the first 3 elements of a given list, the following code can be used: original_list = [1, 2, 3, 4, 5] sublist = original_list[:3] | |
null | Write a python program to sort a list of strings based on their lengths. | ['test', 'sample', 'hello', 'world'] | list_of_strings = ['test', 'sample', 'hello', 'world']
list_of_strings.sort(key=len)
print(list_of_strings) |
[CS Wikipedia] Kostel svatého Vavřince (Rakšice)
Kostel svatého Vavřince je římskokatolický chrám v Rakšicích, čtvrti města Moravský Krumlov v okrese Znojmo. Je chráněn jako kulturní památka České republiky. Historie Kostel byl pravděpodobně založen řádem křižovníků s červenou hvězdou ve 13. století, odborná literatur... | null | null | null |
[DE Wikipedia] Giovanni Boccaccio (1973)
Giovanni Boccaccio ist ein Dokumentarfilm des DEFA-Studios für Kurzfilme von Uwe Belz aus dem Jahr 1973. Handlung Mit dem Spott aus den Werken Giovanni Boccaccios, versucht Uwe Belz in diesem Film eine Verbindung von der Toscana der Renaissance zur DDR der 1970er Jahre aufzubau... | null | null | null |
null | Write a Python program that takes a list of emails and verifies that the domain is valid. | Not applicable | import re
emails = ['user@example.com', 'user@invalid']
def validate_email(email):
regex = r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
if (re.search(regex, email)):
return 1
else:
return 0
for email in emails:
is_valid = validate_email(email)
if is_valid:
print(email, 'is valid')
else:
prin... |
null | Create a Python program to calculate the dot product of two vectors. | [1, 2, 3] and [4, 5, 6] | def dot_product(v1, v2):
total = 0
for (x1, x2) in zip(v1, v2):
total += x1*x2
return total |
null | Modify the following JavaScript code to make it return the absolute value of a given number. | function myFunc(n) { return n; } | function myFunc(n) { return Math.abs(n); } |
null | Construct a for-loop in Python to print the numbers from 1 to 10 (including 1 and 10). | for i in range(1,11):
print(i) | |
null | Write code to generate a random 3x3 tic-tac-toe board in Python. | import random
# our tic-tac-toe board
board = []
# function to generate a random 3x3 tic-tac-toe board
def generate_board():
# create a 3x3 board
board = [[0 for i in range(3)] for j in range(3)]
# populate the board randomly
for row in range(3):
for col in range(3):
board[row][col] = random.choice... | |
null | Create a HTML page with a table showing the contact information of all members in a information. | [ { "name": "John", "phone": "123-456-7890", "address": "123 Main Street" }, { "name": "Sarah", "phone": "098-765-4321", "address": "456 Ocean Drive" } ] | <!DOCTYPE html> <html> <head> <title>Member Contact Information</title> </head> <body> <h1>Member Contact Information</h1> <table> <thead> <tr><th>Name</th></tr> <tr><th>Phone</th></tr> <tr><th>Address</th></tr> </thead> <tbody> <tr><td>John</td><td>123-456-7890</td><td>123 Main Street</td></tr> <tr><td>Sarah</td><td>0... |
null | Create a basic web scraper in Python that takes a URL as input and returns the text content of that URL. | https://www.example.com | import requests
from bs4 import BeautifulSoup
url = 'https://www.example.com'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
text = soup.get_text()
print(text) |
null | Using the turtle module, create a drawing of a triangle. | import turtle <noinput> | import turtle # create an instance of Turtle class my_turtle = turtle.Turtle() my_turtle.speed(0) # draw a triangle my_turtle.forward(100) my_turtle.left(120) my_turtle.forward(100) my_turtle.left(120) my_turtle.forward(100) # finish the drawing my_turtle.done() |
null | Implement an algorithm in Python to find the mode of the given array | arr = [2, 4, 3, 3, 5, 3, 7] | def findMode(arr):
max_count = 1
mode = arr[0]
count = 1
for i in range(1,len(arr)):
if (arr[i] == arr[i - 1]):
count = count + 1 # increment count
if (count > max_count):
max_count = count # update max_count
mode = arr[i]
else:
count = 1 # reset count
return mode
# Driver program
arr = ... |
null | Write a Python function that takes an array of numbers and returns an array with the greatest and smallest values. | [3, 4, 2, 8, 15, 6] | def min_max(arr):
min_val = min(arr)
max_val = max(arr)
return [min_val, max_val]
result = min_max([3, 4, 2, 8, 15, 6])
print(result) |
null | Construct an algorithm in Python for calculating the median of a given list of numbers. | [2, 4, 3, 5, 7] | def calculateMedian(numbers):
n = len(numbers)
if n % 2 == 0:
num1 = numbers[n//2]
num2 = numbers[n//2 - 1]
median = (num1 + num2)/2
else:
median = numbers[n//2]
return median
numbers = [2, 4, 3, 5, 7]
median = calculateMedian(numbers)
print("Median of list is:"... |
null | Modify the following code to make it more efficient by using a while loop. | num = 10 i = 1 while i <= 10: print(i * num) i += 1 | num = 10 i = 0 while i < 10: i += 1 print(i * num) |
null | Design a program in Python to find all words present in a string. | def find_words(s):
words = []
word = []
for char in s:
if char.isalpha():
word.append(char)
else:
if word:
words.append("".join(word))
word = []
if word:
words.append("".join(word))
return words
if __name__ == '__main__':
... | |
null | Given two strings, create a function to find the total number of occurrences of the second string in the first string. | str1 = "Hello World!" str2 = "lo" | def count_string_occurrences(str1, str2): """This function takes in two strings and returns the total number of occurrences of the second string in the first string.""" count = 0 for i in range(len(str1) - len(str2) + 1): if str1[i:i + len(str2)] == str2: count += 1 return count |
null | Write a python script to generate a dictionary containing numbers from 1 to n as keys and their square as values. | def generate_dict(n):
d = {}
for i in range(1, n+1):
d[i] = i*i
return d | |
null | Use a regular expression to find all emails in a given string in Python. | myString = "my name is Joe and my email is joe@example.com" | import re
pattern = "[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+"
result = re.findall(pattern, myString)
print(result) # Output will be ["joe@example.com"] |
[HI Wikipedia] दादोजी कोंडदेव
दादोजी कोंडदेव (१५७७ - १६४९) महाराज शिवाजी के पिता शाहजी के विश्वसनीय ब्राह्मण क्लार्क (कारकुन) थे। पूना में रहनेवाले शाहजी के कुटुंब और वहाँ की उनकी जागीर की देखभाल करने के लिए इनकी नियुक्ति सन् १६३७ ई. में हुई थी। ये इसलिये प्रसिद्ध हैं कि युवा शिवाजी का प्रशिक्षण इनकी ही देखरेख में हुआ... | null | null | null |
[HI Wikipedia] ऍड्वर्ड झील
ऍड्वर्ड झील (अंग्रेज़ी: Lake Edward) या रुतनज़िगे (Rutanzige) या ऍड्वर्ड न्यान्ज़ा (Edward Nyanza) महान अफ़्रीकी झीलों की सबसे छोटी झील है। यह कांगो लोकतान्त्रिक गणराज्य और युगान्डा की अंतरराष्ट्रीय सीमा पर स्थित है और इसका उत्तरी छोर भूमध्य रेखा (इक्वेटर) से कुछ ही किलोमीटर दक्षिण में पड़ता... | null | null | null |
null | Write a shell script to find the most used command. | #!/bin/bash #Store the output of command history into an array historyArray=($(history)) #Declare a Map declare -A wordCount #Loops through the history commands for word in "${historyArray[@]}"; do wordCount["$word"]=$((wordCount["$word"] + 1 )) done #Counter for tracking the most used command maxCount=0 #Loop through ... | |
[HI Wikipedia] नैनी
नैनी (नैनी औद्योगिक क्षेत्र के रूप में भी जाना जाता है) प्रयागराज का पड़ोसी और जुड़वां शहर है। इतिहास नैनी शहर शिक्षा उद्योग इलाहाबाद में शीशा और तार कारखाने काफी हैं। यहां केमुख्य औद्योगिक क्षेत्र हैं नैनी और फूलपुर, जहां कई सार्वजनिक और निजी क्षेत्र की कंपनियों की इकाइयां, कार्यालय और निर्माणियां... | null | null | null |
null | Develop a Python program for generating a random number between given limits. | import random
def random_number(start, end):
return random.randint(start, end) | |
null | Create a function to filter out elements in an array that meet a given criteria. | lst = [2, 3, 4, 5, 6, 7, 8, 9] criteria = lambda x: x % 2 == 0 | def filter_by(lst, criteria): """This function takes an array of elements and a criteria and returns an array of elements filtered by the criteria.""" return [x for x in lst if criteria(x)] |
null | Create an automated program to check if an employee works more than 8 hours a day with Python. | Dataframe of employee working hours:
Name | Hours
-------- | -----
John | 8
Nick | 10
Samantha | 7 | import pandas as pd
# Read the employee working hours dataset
df = pd.read_csv("working_hours_data.csv")
# Define a function to check if an employee is working more than 8 hours
def check_hours(hours):
if hours > 8:
return True
else:
return False
# Add a new column that stores the results of the check
df... |
[CS Wikipedia] Aféra Agrokomerc
Aféra Agrokomerc představovala rozsáhlý hospodářský skandál, který se odehrál v roce 1987 v Bosně a Hercegovině a poukázala na propletenost jugoslávského hospodářství s politikou, stejně jako na neschopnost a horšící se situaci v celé zemi. Poprvé se začalo diskutovat o nelegálních prak... | null | null | null |
null | Design a genetic algorithm in Python to find the optimal value for a given function. | import numpy as np
# Define the target function
def f(x):
return x**3 - 6 * x**2 + 4 * x + 12
# Set the population size
POP_SIZE = 10
# Generate random population of points
np.random.seed(42)
population = np.random.uniform(-10, 10, (POP_SIZE, 2))
# Evaluation
fitness = [f(x) for x in population]
# Selection
... | |
null | Create a ML model in Python to classify different types of fruits. | Dataset containing images of fruits | import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import train_test_split
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D, MaxPool2D, Dense, Flatten
from tensorflow.keras.utils import to_categorical
# Load the dataset
X = np.load('fruits-images.np... |
null | Implement an algorithm in Java to count the number of ones in a binary number | public static int countOnes(int num) { int count = 0; while (num != 0) { num = num & (num - 1); count++; } return count; } | |
null | Create a React component with two TextInputs. | import React from 'react'; const TwoTextInputsForm = () => { return ( <> <TextInput label="Email Address" /> <TextInput label="Password" /> </> ); }; export default TwoTextInputsForm; | |
null | Create a machine learning program in Python for binary classification. | Not applicable | import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
# Read dataset
X = np.loadtxt('./data.txt', delimiter=',')
y = np.loadtxt('./labels.txt')
# Split the dataset
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
# T... |
null | Create a data frame in R with 3 columns and 10 rows of randomly generated numerical data. | dataFrame <- data.frame(V1 = sample(1:100, 10, replace=FALSE), V2 = sample(1:100, 10, replace=FALSE), V3 = sample(1:100, 10, replace=FALSE)) | |
null | Create a JavaScript constant to define a tax rate. | const TAX_RATE = 0.2; | |
[EN Wikipedia] Stockley, Devon
Stockley is a hamlet on the eastern outskirts of Okehampton, in Devon, England. It lies just north of the A30. References Hamlets in Devon | null | null | null |
[CS Wikipedia] Mortagne-au-Perche
Mortagne-au-Perche je francouzská obec v departementu Orne v regionu Normandie. V roce 2010 zde žilo 4 093 obyvatel. Je centrem arrondissementu Mortagne-au-Perche a kantonu Mortagne-au-Perche. Vývoj počtu obyvatel Související články Seznam obcí v departementu Orne Externí odkazy Refer... | null | null | null |
[DE Wikipedia] Thomas Hölck
Thomas Hölck (* 21. September 1962 in Hamburg) ist ein deutscher Politiker (SPD), Diplom-Bauingenieur, und seit 2005 Mitglied des Schleswig-Holsteinischen Landtages. Leben und Beruf Nach der Mittleren Reife 1979 machte Hölck bis 1982 eine Lehre zum Maurer und besuchte anschließend die Facho... | null | null | null |
null | Write a function in Python to delete duplicates from a list. | [1,1,3,4,4,5] | def remove_duplicates(lst):
return list(set(lst))
remove_duplicates([1,1,3,4,4,5]) |
[HI Wikipedia] अरविन्द घोष
अरविन्द घोष या श्री अरविन्द (बांग्ला: শ্রী অরবিন্দ, जन्म: १८७२, मृत्यु: १९५०) एक योगी एवं दार्शनिक थे। वे १५ अगस्त १८७२ को कलकत्ता में जन्मे थे। इनके पिता एक डाक्टर थे। इन्होंने युवा अवस्था में स्वतन्त्रता संग्राम में क्रान्तिकारी के रूप में भाग लिया, किन्तु बाद में यह एक योगी बन गये और इन्ह... | null | null | null |
null | Create a function in Python to extract the substring from the given string between the two key words, ``start`` and ``end`` | string = "This is a test string and the key words are start and end"
start = "start"
end = "end" | def extract_substring(string, start, end):
'''This function will extract the substring between two given key words'''
if start in string and end in string:
start_index = string.find(start) + len(start)
end_index = string.find(end)
extracted_string = string[start_index:end_index]
... |
null | Create a CSS class named 'main-section' with a width of 700px and a margin of 0 auto. | .main-section { width: 700px; margin: 0 auto; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.