text
stringlengths
141
2.89k
⌀
instruction
stringlengths
19
1.5k
⌀
input
stringlengths
0
800
⌀
output
stringlengths
1
2.5k
⌀
null
Write a CSS rule to set the font family of all <h1> tags to be "Roboto".
h1 { font-family: 'Roboto'; }
[HI Wikipedia] तबला तबला भारतीय संगीत में प्रयोग होने वाला एक तालवाद्य है जो मुख्य रूप से दक्षिण एशियाई देशों में बहुत प्रचलित है। यह लकड़ी के दो ऊर्ध्वमुखी, बेलनाकार, चमड़ा मढ़े मुँह वाले हिस्सों के रूप में होता है, जिन्हें रख कर बजाये जाने की परंपरा के अनुसार "दायाँ" और "बायाँ" कहते हैं। यह तालवाद्य हिन्दुस्तानी शास...
null
null
null
null
Write a CSS code snippet to give all paragraphs a font size of 16px.
p { font-size: 16px; }
null
Generate a Python program which can produce the sum of all even numbers between 0 and n, including zero.
def sum_even_nums(n): sum = 0 for i in range(0, n+1): if i%2 == 0: sum += i return sum
null
Write a SQL query to select users who have a username that starts with "S".
SELECT * FROM users WHERE username LIKE 'S%';
null
Implement a gradient descent algorithm for a classification task in Python.
def grad_descent_classifier(input_data, weights, learning_rate): # finding the gradient of our weights w.r.t to cost function N = len(input_data) grad = np.zeros(weights.shape) error = 0 # looping through each training datapoint for i in range(N): x = input_data[i] y = input_...
null
What is the best way to sort an array of integers in descending order using Python?
[99, 65, 43, 87, 21]
def sortDesc(arr): arr.sort(reverse=True) return arr arr = [99, 65, 43, 87, 21] print(sortDesc(arr)) // Output: [99, 87, 65, 43, 21]
null
Can you develop a basic web server in Python that serves a webpage when queried?
from http.server import HTTPServer, BaseHTTPRequestHandler from urllib.parse import urlparse class RequestHandler(BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) self.send_header('Content-Type', 'text/html') self.end_headers() self.wfile.write(b"<!DOCTYPE html><html><head> <title>...
[HI Wikipedia] ऐलिस प्रयोग ऐलिस प्रयोग का पूर्ण नाम ए लार्ज आयन कोलाइडर एक्सप्रिमेंट जिसका हिन्दी अनुवाद एक विशाल आयन संघट्ट प्रयोग () है। यह सर्न लार्ज हैड्रान कोलाइडर नामक त्वरक पर आँकड़े इकट्ठा करने वाले ७ कण भौतिकी प्रयोगो में से एक है। यह भारी आयनों की टक्कर के अध्ययन के लिए इष्टतम है। भौतिक उद्देश्य इस प्रयोग को...
null
null
null
[HI Wikipedia] हेनरी का नियम भौतिकी में हेनरी का नियम गैस के भौतिक गुणों से सम्बन्धित एक नियम है जिसे विलियम हेनरी ने १८०३ में प्रतिपादित किया था। हेनरी के नियम के अनुसार- किसी नियत ताप पर, किसी द्रव के निश्चित आयतन में घुल सकने वाली किसी गैस की मात्रा उस गैस के उस द्रव के साथ साम्यावस्था की स्थिति में आंशिक दाब के सम...
null
null
null
[CS Wikipedia] Tennie Tennie je francouzská obec v departementu Sarthe v regionu Pays de la Loire. V roce 2010 zde žilo 1 051 obyvatel. Vývoj počtu obyvatel Související články Seznam obcí v departementu Sarthe Externí odkazy Reference Obce v departementu Sarthe
null
null
null
null
Write a python program to calculate the discount rate based on a given purchase price and discount amount.
The purchase price is $100, the discount amount is $10.
discount_rate = 10/100 discount = purchase_price * discount_rate purchase_price = 100 discount_rate = 10/100 discount = purchase_price * discount_rate print("The discount is: ${}".format(discount))
null
Write a python program for searching for a specific product within a given list of products.
products = ["Apple", "Banana", "Cherry", "Grape"] search_query = "Grape"
# Define a search function def search (products, query): # Loop through list for product in products: if product == query: # Return the product index if it matches the query return products.index(product) # Get the index of the item result = search(products, search_query) # Print the result print...
null
Create a Python program to detect anagrams. An anagram is a word or phrase formed by rearranging the letters of another word or phrase.
words: "dear", "read"
def isAnagram(word1, word2): # Get lengths of both strings n1 = len(word1) n2 = len(word2) # If both strings have different lengths, they # cannot be anagrams if (n1 != n2): return False # Sort both strings word1 = sorted(word1) word2 = sorted(word2) ...
null
Generate a code that takes an array of integers and splits them into two equal halves
arr = [1, 2, 3, 4, 5, 6]
def split_array(arr): n = len(arr) mid = n//2 left_half = arr[:mid] right_half = arr[mid:] return left_half, right_half
null
Suggest a way to complete the following Python program which takes two strings as input and prints out the longer string.
first_str = 'hello' second_str = 'world'
if len(first_str) == len(second_str): print('The two strings are of equal length.') elif len(first_str) > len(second_str): print(first_str) else: print(second_str)
null
Generate a Python program to find the longest sequence of increasing numbers in a given list.
data = [1, 10, 3, 11, 7, 8, 4, 2]
data = [1, 10, 3, 11, 7, 8, 4, 2] max_sequence = 0 curr_sequence = 0 prev = -1 for num in data: # Check if the current number is larger than the previous one if num > prev: curr_sequence += 1 max_sequence = max(max_sequence, curr_sequence) else: # Reset the length of the current sequence ...
null
Write a Python program to iterate the given list and print the square or each element.
my_list = [1, 2, 3, 4]
my_list = [1, 2, 3, 4] for i in my_list: print(i**2) # Output: 1, 4, 9, 16
[DE Wikipedia] Thomas de Bourlémont Thomas de Bourlémont (auch Thomas d’Anglure de Bourlemont; * vor 1311; † April 1353) war ein französischer Bischof. Leben Die erste Erwähnung findet Thomas de Bourlémont im Juli 1311 zusammen mit seinen Eltern, Pierre, Herr von Bourlémont, und Jeanne de Choiseul, als er für eine kir...
null
null
null
null
Create a Python script to calculate the total number of visitors on a Web page.
Number of visitors per day (example: 2000, 1500, 2500, 1800)
visitors_per_day = [2000, 1500, 2500, 1800] total_visitors = sum(visitors_per_day) print("Total number of visitors:", total_visitors)
null
Transform an input string to its uppercase equivalent with JavaScript.
inputString="This sentence should be in uppercase"
let inputString = "This sentence should be in uppercase"; let outputString = inputString.toUpperCase(); console.log(outputString);
null
Create a class in Python with the attributes name and age.
class Person: def __init__(self, name, age): self.name = name self.age = age
null
Write code to find the depth of a binary tree.
// Recursive function to find the maximum depth // of a binary tree int maxDepth(Node *root) { // Base case if (root == NULL) return 0; // Recur for left subtree and right subtree int lDepth = maxDepth(root->left); int rDepth = maxDepth(root->right); // Use the larger one if (lDepth > rDepth) return lDepth + 1; else re...
null
Create a visualization to compare the customer preferences of two websites.
Website 1 has 4000 customers and their favourite products are video games and consoles. Website 2 has 5000 customers and their favourite products are movies, music and books.
The customer preferences can be compared using a bar chart. The X-axis can have the labels ‘Website 1’ and ‘Website 2’ and the Y-axis can have ‘Video games/Consoles’, ‘Movies’, ‘Music’ and ‘Books’ on the axis. The bars can represent the percentage of customers with the corresponding favourite product.
[CS Wikipedia] Uli Hoeneß Ulrich „Uli“ Hoeneß (* 5. leden 1952, Ulm) je bývalý německý fotbalista a fotbalový manažer. Hrával na pozici útočníka nebo záložníka. S reprezentací někdejšího Západního Německa se stal mistrem Evropy roku 1972 (zařazen i do all-stars turnaje) a mistrem světa roku 1974. Získal též stříbro na...
null
null
null
null
Implement a search algorithm in C++ that takes in a list of integers and a target value and finds the index of the target if it exists in the list.
List: [2, 4, 6, 8, 10], Target: 8
// C++ Program to implement Search #include <bits/stdc++.h> using namespace std; // function to implement search int search(vector <int> list, int x) { // traversing the list for (int i = 0; i<list.size(); i++) if (list.at(i) == x) return i; return -1; } // driver code int main() { vector <int> list({2, 4, 6, 8, 10}); ...
null
Formulate a regular expression in Python that matches words that starts with any two letters followed by two digits.
regex = r"^[a-zA-Z]{2}\d{2}"
null
Create an if-else statement that prints "Welcome!" if the input is "John" and "Goodbye!" if the input is "Caroline".
if name == "John": print("Welcome!") else: print("Goodbye!")
[DE Wikipedia] Weldolet Ein Weldolet ist ein Bauteil, das im Rohrleitungsbau Verwendung findet. Einsatz Das Weldolet ermöglicht beim Leitungsbau eine 90°-Abzweigung und stellt somit eine Alternative zum T-Stück dar. Erforderlich ist eine Bohrung im Rohr, in die das Kopfende des Weldolets eingeschweißt wird. Ein ähnlic...
null
null
null
null
Generate a program in Python that takes two strings and returns a list containing the combined string.
("Hello ", "World!")
def combine_strings(str1, str2): return [str1 + str2] combined_string = combine_strings("Hello ", "World!") print(combined_string) # ["Hello World!"]
null
Create an array of 5 students and output their names.
var students = [ {name: 'John', age: 19}, {name: 'Amy', age: 22}, {name: 'Luke', age: 17}, {name: 'Alex', age: 18}, {name: 'Tom', age: 20} ];
names = [students[0].name, students[1].name, students[2].name, students[3].name, students[4].name]; console.log(names); // output: ['John', 'Amy', 'Luke', 'Alex', 'Tom']
[HI Wikipedia] हिन्दुत्व हिंदुत्व (शाब्दिक अर्थ: हिंदूपन) एक राजनीतिक विचारधारा है जिसमें हिंदू राष्ट्रवाद के सांस्कृतिक औचित्य को शामिल किया गया है I हिंदुत्व शब्द का इस्तेमाल पहली बार १८९२ में चंद्रनाथ बसु ने किया था और बाद में इस शब्द को १९२३ में विनायक दामोदर सावरकर ने लोकप्रिय बनाया। यह हिंदू राष्ट्रवादी स्वयंसेव...
null
null
null
null
Create a SQL query to join two tables called Employees and Departments.
Employees table has the following columns: Emp_ID: int Name: string Age: int Dept_ID: int Departments table has the following columns: Dept_ID: int Dept_Name: string Location: string
SELECT e.Name, e.Age, d.Dept_Name, d.Location FROM Employees e INNER JOIN Departments d ON e.Dept_ID = d.Dept_ID;
null
Create a neural network using TensorFlow.
import tensorflow as tf model = tf.keras.Sequential([ tf.keras.layers.Dense(units=128, activation='relu', input_shape=(10,)), tf.keras.layers.Dense(units=128, activation='relu'), tf.keras.layers.Dense(units=128, activation='softmax') ]) model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['a...
[CS Wikipedia] Christoph Amberger Christoph Amberger (1505 v Augsburgu – 1562) byl německý renesanční portrétista, který v polovině 16. století působil v Norimberku. Byl hlavním představitelem augsburské školy a stal se jedním z nejlepších portrétistů německé renesance. Své vzdělání získal Amberger u malíře Leonharda ...
null
null
null
null
Find the mean of the following set of numbers: 10, 20, 30, 40
25
null
Classify an input sentence with a given set of labels in Python.
The car is blue
def classify_sentence(sentence): labels = [‘color’, ‘object’] features = sentence.split(' ') feature_dict = {} for f in features: if f == 'blue': feature_dict['color'] = 'blue' elif f == 'car': feature_dict['object'] = 'car' return feature_dict sentence = 'Th...
[CS Wikipedia] Arcis-sur-Aube Arcis-sur-Aube je francouzská obec v departementu Aube v regionu Grand Est. V roce 2011 zde žilo 2 988 obyvatel. Je centrem kantonu Arcis-sur-Aube. Sousední obce Le Chêne, Nozay, Ormes, Saint-Étienne-sous-Barbuise, Torcy-le-Grand, Villette-sur-Aube Vývoj počtu obyvatel Související články ...
null
null
null
null
Output the number of words in a given sentence stored as a string.
"Welcome to the world of coding!"
def count_words(sentence): return len(sentence.split()) if __name__ == '__main__': sentence = "Welcome to the world of coding!" print(count_words(sentence))
null
Write a SQL query to get the names of all customers who have placed orders from a given store in the last week.
Given store name: "ABC Store"
SELECT DISTINCT c.name FROM customer c INNER JOIN order o ON c.customer_id = o.customer_id WHERE o.store_name = "ABC Store" AND o.date_ordered >= DATE_SUB(CURDATE(), INTERVAL 7 DAY);
null
Create a python function to extract the intersection of two lists.
listOne = [5,4,3] listTwo = [3,2,1]
def intersection(listOne, listTwo): return list(set(listOne).intersection(set(listTwo)))
null
Write a CSS code to center align the given text.
p { text-align: center; }
null
How can we remove duplicate elements from a given array?
We can use a set data structure to remove duplicate elements from a given array. Sets are collections of unique elements, so when the elements are added to the set, the duplicate elements are automatically removed. Example: arr = [1,2,3,3,4,5,5] arr = list(set(arr)) # arr will be [1,2,3,4,5]
null
Create a CSS style to make all paragraphs with a bottom margin of 10px.
p { margin-bottom: 10px; }
null
Generate a random integer between 4 and 8 (inclusively).
import random x = random.randint(4, 8)
null
Write a python program to verify if the given DNA strand is a palindrome or not.
def is_palindrome_dna(dna): # Step 1: Extract the complementary strand by replacing each nucleotide with its complement in the strand complement = "" for letter in dna: if letter == 'A': complement += 'T' elif letter == 'C': complement += 'G' elif letter == '...
[HI Wikipedia] नगाँव नगाँव (Nagaon) भारत के असम राज्य के नगाँव ज़िले में स्थित एक नगर है। यह ज़िले का मुख्यालय भी है। नगाँव गुवाहाटी से 120 किमी पूर्व में कोलोंग नदी के किनारे बसा हुआ है, और असम का पाँचवा सबसे बड़ा नगर है। विवरण नगांव कृषि व्यापार केंद्र है और यहाँ गुवाहाटी विश्वविद्यालय से संबद्ध कई होमोयोपैथिक चिकित...
null
null
null
null
Write a React component to render a table with 4 columns and 5 rows.
class MyTable extends Component { render() { return ( <table> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> <tr> <td>1</td> <td>2</td> <td>3</td> ...
null
Generate a Python algorithm to multiply two number.
x = 8 y = 3
def mul_numbers(x, y): return x*y
null
Implement a Python function to calculate the sum of all prime numbers between two given numbers, inclusive.
2 5
def prime_sum(start,end): total = 0 for num in range(start, end + 1): if num > 1: for i in range(2, num): if (num % i) == 0: break else: total += num return total if __name__ == "__main__": lower_limit = int(input('I...
null
Given the following code in C, modify it to increment `num` by 1.
int num = 0;
int num = 0; num++;
[CS Wikipedia] Musée Cognacq-Jay Musée Cognacq-Jay je městské muzeum v Paříži. Nachází se v historické čtvrti Marais ve 3. obvodu v ulici Rue Elzévir v městském paláci Hôtel de Donon. Muzeum vystavuje sbírku evropského umění 18. století, kterou vytvořili a městu odkázali obchodník Ernest Cognacq a jeho manželka Marie-...
null
null
null
null
Parse the sentence and find the sentence structure.
Sentence: I arrived at the destination late in the evening.
Subject: I Verb: arrived Prepositional phrase: at the destination Adverb clause: late in the evening Sentence structure: (S (NP I) (VP arrived) (PP at the destination) (AdvCl late in the evening))
null
Create a Python program to find the sum of the Fibonacci sequence.
def fibonacci_sum(n): if n <= 1: return n previous = 0 current = 1 sum = 1 for _ in range(n - 1): previous, current = current, previous + current sum += current return sum
[HI Wikipedia] २०१३ शाहबाग विरोध २०१३ के बांग्लादेश के शहबाघ जन आन्दोलन की शुरुवात ५ फ़रवरी २०१३ को ढाका, बांग्लादेश में हुई, जिसमे अब्दुल कादिर मोल्लाह और अतिरिक्त सभी बांग्लादेशी मुक्ति संग्राम के आरोपित युद्ध अपराधियों के लिए मौत की सज़ा की मांग करी गयी, | ५ फ़रवरी २०१३ को बांग्लादेश अंतर्राष्ट्रीय अपराध न्यायलय ने...
null
null
null
null
Given the following code snippet, write the code to achieve the expected output
def convert_to_title_case(input): # Expected Output: # input = "this is a Title" # Output = This Is A Title
def convert_to_title_case(input): words = input.split(' ') output = [] for word in words: output.append(word.capitalize()) return ' '.join(output) # Expected Output: input = "this is a title" # Output = This Is A Title print(convert_to_title_case(input))
null
Fix the bug in the following Python program.
def calculateArea(width, height): return width * height length = 8 breadth = 10 area = calculateArea(length) print("Area of the rectangle:", area)
def calculateArea(width, height): return width * height length = 8 breadth = 10 area = calculateArea(length, breadth) print("Area of the rectangle:", area)
[CS Wikipedia] Karel Mareš Karel Mareš může být: Karel Mareš (starosta) (1872–1952), sociálnědemokratický politik a starosta Olomouce Karel Mareš (vojenský letec) (1898–1960), brigádní generál a první velitel 311. československé bombardovací perutě RAF Karel Mareš (skladatel) (1927–2011), hudební skladatel, scenárista...
null
null
null
null
Write a JavaScript statement to create a new object, Person, with the fields "name", "age" and "city".
let Person = { name: '', age: 0, city: '' };
null
Write a class definition in python that will initialize an object of the class with given parameters
name, age
class Person: def __init__(self, name, age): self.name = name self.age = age
[HI Wikipedia] कड़ाही चिकन कड़ाही चिकन एक उत्तर भारतीय मांसाहारी व्यंजन हैं। यह आमतौर पर चिकन से बनाया जाता है। केवल एक ही बर्तन इस पकवान पकाने के लिए पर्याप्त है और यह एक कड़ाही है। सन्दर्भ रसोई भारतीय खाना खान पान
null
null
null
null
Design a visualization using Dash in Python that displays hospitality data. This visualization should include an interactive 3D line chart that shows the trend in data input by the user.
Not applicable
import dash import dash_cytoscape as cyto import plotly.graph_objects as go app = dash.Dash(__name__) # create 3D line chart using Plotly x_values = [0,0.2,0.4,0.6,0.8,1] # just example values y_values = [0,0.5,1,2,1.5,3] # just example values z_values = [0,1,2,3,4,4] # just example values trace1 = go.Scatter3d(x = ...
null
Write a JavaScript program that will console log the first 10 numbers of the Fibonacci sequence.
let x = 0; let y = 1; for (let i = 0; i < 10; i++) { let z = x + y; console.log(z); x = y; y = z; }
null
Write an SQL query to return the most frequently used keyword from the table.
Table Name: "Keywords" Column Name: "keyword"
SELECT keyword, COUNT(*) as occurrence FROM Keywords GROUP BY keyword ORDER BY occurrence DESC LIMIT 1;
[EN Wikipedia] KHGN KHGN may refer to: KHGN (FM), a radio station (106.7 FM) licensed to serve Hugoton, Kansas, United States KVSR, a radio station (90.7 FM) licensed to serve Kirksville, Missouri, United States, which held the call sign KHGN from 1996 to 2010
null
null
null
[CS Wikipedia] Francouzská nová vlna Francouzská nová vlna (francouzsky La Nouvelle Vague) byl termín, kterým kritici označovali skupinu formálně progresivních francouzských filmových režisérů, tvořících v pozdních 50. a v 60. letech minulého století. Byli ovlivněni italským neorealismem, klasickým hollywoodským filme...
null
null
null
null
Improve the following code by implementing a more efficient algorithm.
def FunctionA(arr): output = [] for elem in arr: if elem > 0 and not elem in output: output.append(elem) return output
def FunctionA(arr): output = set() for elem in arr: if elem > 0: output.add(elem) return list(output)
null
Develop an algorithm in Python for parsing a given text and counting the number of occurrences of a given word.
This is an example text.
def parse_text(text, word): word_count = 0 words = text.split() for w in words: if w == word: word_count += 1 return word_count text = 'This is an example text.' word = 'example' word_count = parse_text(text, word) print('The word "{}" appears {} times in the text.'.format(word, word_count))
null
Using an object-oriented programming language, create a class that has two methods - one to calculate the area of a circle and another to calculate the circumference.
class Circle(): def __init__(self, radius): self.radius = radius def area(self): return self.radius ** 2 * 3.14 def circumference(self): return 2 * self.radius * 3.14
null
Edit the code below to sort the list of integers given in the input.
list_in = [40, 32, 12, 19]
list_in = [40, 32, 12, 19] list_in.sort() print(list_in) #output: [12, 19, 32, 40]
null
Convert the following JSON string into a Python dictionary.
{"a":1, "b": "Hello", "c": {"d": [34, 56]}}
import json json_string = '{"a":1, "b": "Hello", "c": {"d": [34, 56]}}' parsed_json = json.loads(json_string) print(parsed_json) # Output: {'a': 1, 'b': 'Hello', 'c': {'d': [34, 56]}}
null
Write a python program to detect palindromes in a given list of strings
['malayalam', 'rotator', 'civic']
def is_palindrome(word): # reverse word reverse_word = word[::-1] # Compare reverse word and original word if reverse_word == word: return True else: return False # main words = ['malayalam', 'rotator', 'civic'] for word in words: if is_palindrome(word): print(f'{word} ...
null
Write a function to perform buble sort.
public void bubbleSort(int[] array) { int n = array.length; for (int i = 0; i < n-1; i++) { for (int j = 0; j < n-i-1; j++) { if (array[j] > array[j+1]) { int temp = array[j]; array[j] = array[j+1]; array[j+1] = temp; } } } }
null
Please write an SQL query to find the records that have a value higher than the average of all values.
SELECT * FROM table_name WHERE value > (SELECT AVG(value) FROM table_name);
[EN Wikipedia] Çardaklı, Hani Çardaklı () is a neighbourhood in the municipality and district of Hani, Diyarbakır Province in Turkey. It is populated by Kurds and had a population of 1,706 in 2022. References Neighbourhoods in Hani District Kurdish settlements in Diyarbakır Province
null
null
null
null
Create a command to delete a folder with all its contents.
/root/folder
import os def remove_folder(folder): for filename in os.listdir(folder): file_path = os.path.join(folder, filename) try: if os.path.isfile(file_path) or os.path.islink(file_path): os.unlink(file_path) elif os.path.isdir(file_path): shutil.rmtree(file_path) except Exception as e: print('Failed to delete %s. Reason: %s' ...
null
Create a method that returns all elements in an array that are larger than the given value x.
[2, 3, 5, 7, 11, 13] and x = 4
def elements_greater_than_x(arr, x): result = [] for el in arr: if el > x: result.append(el) return result
null
Design a python function to tokenise a given sentence into basic components like words and punctuations.
# Importing the essential library import nltk # Defining a function to tokenize a sentence def tokenize(text): tokens = nltk.word_tokenize(text) tok_words = [tok for tok in tokens if tok.isalpha()] tok_punct = [tok for tok in tokens if not tok.isalpha()] return tok_words, tok_punct if __name__ == '...
null
Create a neural network in Python to recognize the handwritten digits from 0 to 9.
""" Create a neural network in Python to recognize the handwritten digits from 0 to 9. """ import tensorflow as tf import numpy as np from tensorflow import keras # load the MNIST dataset mnist = keras.datasets.mnist (x_train, y_train), (x_test, y_test) = mnist.load_data() # normalize the data x_train, x_test = x_tr...
[EN Wikipedia] Klobučar Klobučar is a Croatian and Slovenian surname (from klobučar, "hatter") and toponym, which may refer to: People with the surname Anđelko Klobučar (1931–2016), Croatian composer, organist and professor Berislav Klobučar (1924–2014), Croatian opera conductor Jaka Klobučar (born 1987), Slovenian pr...
null
null
null
[EN Wikipedia] O'Dayne Richards O'Dayne Valentin Richards (born 14 December 1988 in St. Andrew) is a Jamaican athlete competing in the shot put and discus throw. He studied at the University of Technology, Jamaica. Achievements Personal bests Outdoor Shot Put – 21.96 (Rabat 2017) Discus Throw – 58.31 (Kingston 2012) I...
null
null
null
null
Create a PHP script to iterate through a list of numbers and determine if any of the numbers are divisible by 5.
my_list = [18, 22, 10, 27]
<?php $my_list = [18, 22, 10, 27]; $divisible = False; foreach ($my_list as $num){ if($num % 5 == 0){ $divisible = True; break; } } echo $divisible;
[CS Wikipedia] Vůz Bbdgmee236 ČD {{DISPLAYTITLE:Vůz Bbdgmee236 ČD}} Vozy řady Bbdgmee236, číslované v intervalu 61 54 84-71, jsou jednou z řad víceúčelových osobních vozů druhé třídy z vozového parku Českých drah. Vozy vznikly mezi lety 2012 a 2014 modernizací všech vozů řad BDbmsee447, Bdhmsee448 a Bdhmsee451 vyjma v...
null
null
null
null
Write a JavaScript program that takes an array of strings as an argument and then prints those strings in alphabetical order.
function alphabeticalOrder(arr) { // Sort items in the array arr.sort(function(a, b) { return a.localeCompare(b); }); // Print out the sorted array console.log(arr); }
[HI Wikipedia] अक़तऊ अक़तऊ, जो १९६४-१९९१ काल में शेवचेंको के नाम से जाना जाता था, पश्चिमी काज़ाख़स्तान का एक बड़ा शहर है और उस देश की कैस्पियन सागर पर सबसे बड़ी बंदरगाह है। यह काज़ाख़स्तान के मान्गीस्त​ऊ प्रांत की राजधानी भी है। काज़ाख़ भाषा में 'अक़तऊ' का मतलब 'सफ़ेद पहाड़' होता है और यह कैस्पियन सागर पर स्थित श्वेत ...
null
null
null
null
Create a Python program to check if a number is an Armstrong number.
number = 153
def isArmstrong(number): num = number length = len(str(number)) sum_of_the_power_of_digits = 0 while num > 0: rem = num % 10 sum_of_the_power_of_digits = sum_of_the_power_of_digits + np.power(rem, length) num //= 10 if (sum_of_the_power_of_digits == number) : return True else : return Fal...
null
Create a method in Python to sum up all the elements of a given list.
# sum_list function takes in a list and # returns the sum of the elements of the list def sum_list(input_list): # Set sum to 0 sum = 0 # Iterate through the list and # add each element to the sum for element in input_list: sum = sum + element # Return the sum return sum
null
Create a random forest regressor in Python to predict house prices from square footage, number of bedrooms, and neighborhood.
Not applicable
import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor # get data df = pd.read_csv('house_prices.csv') # split the dataset into input and target variables X = df[['square_footage', 'bedrooms', 'neighborhood']] y = df['price'] # o...
[CS Wikipedia] Jindřich III. Kastilský Jindřich III. Kastilský zvaný el Doliente (churavý) (4. října 1379, Burgos – 25. prosince 1406, Toledo) byl kastilský král v letech 1390–1406. Biografie Původ, mládí Narodil se jako prvorozený ze dvou synů kastilského krále Jana I. a jeho první manželky Eleonory Aragonské, dcery ...
null
null
null
null
Generate a program written in Python that takes in two numbers from the user and prints out the greatest common divisor of the two.
Not applicable
def GCD(a, b): # base case if (a == 0): return b if (b == 0): return a # a is greater if (a > b): return GCD(a % b, b) else: return GCD(a, b % a) # Driver Program a = 98 b = 56 if(GCD(a, b)): print('GCD of', a, 'and', b, 'is', GCD(...
null
Suggest a command to check for any available updates for a package called 'foo' using the package manager 'apt'?
sudo apt-get update foo
null
Generate a list with the numbers from 1 to 10 using Python.
# Generate a list with the numbers from 1 to 10 listA = [] for i in range(1,11): listA.append(i) print(listA)
null
Write a Java Program to print the Fibonacci numbers for a given range.
public class Fibonacci { public static void main(String[] args) { int range = 10; int i = 0; int fibo = 0; int fibo1 = 1; int fibo2 = 1; while(i <= range) { System.out.print(fibo + " "); fibo = fibo1 + fibo2; fibo1 = fibo2; fibo2 = fibo; i++; } } }
null
Subtract the given list of numbers using JavaScript.
List: [8, 3, 6]
-9
[CS Wikipedia] Zemské volby v Čechách 1901 Zemské volby v Čechách 1901 byly volby konané v Českém království od 8. do 15. října 1901 (užší volby, tj. druhá kola volebních klání v některých obvodech, se konaly ještě 16. a 17. října), kterými byli zvoleni poslanci Českého zemského sněmu coby zákonodárného sboru zemské s...
null
null
null
[EN Wikipedia] Chinese cruiser Hai Yung Hai Yung () was a protected cruiser of the Imperial Chinese Navy. Hai Yung was one of a class of three ships built in Germany for the Chinese after the losses of the First Sino-Japanese War. The ship was a small protected cruiser with quick-firing guns, a departure from the prew...
null
null
null
null
Write a Python program to detect and remove the duplicates in a list.
The list is [1, 20, 4, 6, 20, 4, 1, 6].
def remove_duplicates(lst): return list(dict.fromkeys(lst)) lst = [1, 20, 4, 6, 20, 4, 1, 6] print(remove_duplicates(lst))
[CS Wikipedia] Trans žena Trans žena (též MtF, jakožto zkratka z anglického Male to Female, nebo česky chybně transžena) je osoba, která byla při narození označena za muže (protože se narodila s mužskými pohlavními orgány), ale která sama sebe identifikuje jako ženu. Trans ženy mohou pociťovat genderovou dysforii (gen...
null
null
null
null
Implement a code to print the indices of all occurrences of a number x in an array arr.
x = 5 arr = [1, 5, 2, 8, 5, 10]
def print_indices(x, arr): indices = [] for i in range(len(arr)): if arr[i] == x: indices.append(i) return indices print(print_indices(x, arr)) # [1, 4]
null
Explain how you would use the givew array to create a valid JSON output.
array = [ "firstname" => "Nikola", "lastname" => "Tesla", "birthdate" => "10-07-1856" ]
We can use the given array to create a valid JSON output by first converting it into an object by wrapping it in curly brackets and then assign keys for each value. For example, { "firstname": "Nikola", "lastname": "Tesla", "birthdate": "10-07-1856" } Once the object is created, it need to be converted to a JSON string...