text stringlengths 141 2.89k ⌀ | instruction stringlengths 19 1.5k ⌀ | input stringlengths 0 800 ⌀ | output stringlengths 1 2.5k ⌀ |
|---|---|---|---|
[HI Wikipedia] क्रिस्टीज़
क्रिस्टी'ज़ () वर्तमान में कला व्यवसाय और ललित कला से संबंधित विश्व का सबसे बड़ा नीलामी घर है। क्रिस्टी'ज़ ने 2012 की पहली छमाही के लिए लगभग 3.5 अरब डॉलर की बिक्री के साथ, किसी समतुल्य अवधि के लिए कंपनी और कला बाजार के इतिहास में सबसे बेहतर परिणाम प्रदर्शित किया। लंदन किंग स्ट्रीट और रॉकफेलर ... | null | null | null |
null | Write a Python program to optimize a given function using gradient descent. | import numpy as np
def optimize(f, lr, num_iterations):
x = 0.0
for i in range(num_iterations):
grad = numerical_diff(f, x)
x -= lr * grad
return x
def numerical_diff(f, x):
h = 1e-4#0.0001
return (f(x+h) - f(x-h)) / (2*h) | |
null | Convert this string to a float in Python. | string = "1.25" | string = "1.25" float_value = float(string) |
null | Create a basic form in HTML containing two input boxes for first name and surname. | <html> <head> <title>User Information Form</title> </head> <body> <form> First Name:<br> <input type="text" name="firstname"><br> Surname:<br> <input type="text" name="surname"><br><br> <input type="submit"> </form> </body> </html> | |
null | Generate the Fibonacci sequence up to the 10th number. | 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 | |
[EN Wikipedia] Gerrit Beneker
Gerrit Albertus Beneker (January 26, 1882 – October 23, 1934) was an American painter and illustrator best known for his paintings of industrial scenes and for his poster work in World War I. Biography Beneker was born on January 26, 1882, in Grand Rapids, Michigan, the son of Bartel Albe... | null | null | null |
null | Create a NodeJS server that listens on port 8080 and serves a simple HTML page. | const http = require('http'); const port = 8080; const server = http.createServer(function (request, response) { response.writeHead(200, { "Content-Type": "text/html" }); response.write('<html><body><h1>Hello, World!</h1></body></html>'); response.end(); }); server.listen(port); console.log("Listening at port", port); | |
[CS Wikipedia] Weikendorf
Weikendorf je městys v Rakousku ve spolkové zemi Dolní Rakousy v okrese Gänserndorf. Geografie Geografická poloha Weikendorf se nachází ve spolkové zemi Dolní Rakousy v regionu Weinviertel. Rozloha území městyse činí 46,3 km², z nichž 12,4 % je zalesněných. Části obce Území městyse Weikendorf... | null | null | null |
null | Create a class in Python and define several functions for that class. | class MyClass: def __init__(self): pass def add(self, x, y): return x + y def subtract(self, x, y): return x - y def multiply(self, x, y): return x * y def divide(self, x, y): return x / y | |
null | Create an array of 10 numbers in JavaScript, each with a value of 0. | let array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; | |
null | Create a virtual environment in Python using the "virtualenv" tool. | python -m pip install virtualenv virtualenv envname source envname/bin/activate | |
null | Extract a specific key-value pair from the given dictionary | dic = {"Name": "John", "age": "27", "Address": "Street 79"} | Age = dic["age"] |
null | Write a script in Ruby for calculating the sum of two numbers. | a = 5 b = 10 | a = 5 b = 10 def add_numbers(a, b) a + b end sum = add_numbers(a,b) puts "The sum of #{a} and #{b} is #{sum}." |
[EN Wikipedia] Sanda Wuduroma of Borno
Sanda Wuduroma, or Abu Sanda bin Buqar al-Kanemi, (?-1894) was Shehu of Borno in 1894. Reign At the death of his brother and predecessor Shehu Kyari, Sanda Wuduroma (also known as Abba Sanda Limannambe) became Shehu of Borno in 1893 when the country was invaded by Rabih az-Zubayr... | null | null | null |
null | Modify the given python program to accept an input string and output the length of that string. | def func(): print("Hello World!") | def func(s): print("Length of the string is: " + str(len(s))) |
[DE Wikipedia] Champions League 2006
Champions League 2006 steht für: AFC Champions League 2006, asiatischer Fußballwettbewerb für Vereinsmannschaften der Männer CAF Champions League 2006, afrikanischer Fußballwettbewerb für Vereinsmannschaften der Männer CONCACAF Champions’ Cup 2006, nord- und mittelamerikanischer Fu... | null | null | null |
null | Create a Python script that takes a string as an input and outputs a list of words that all contain at least one vowel. | "Hello my name is John" | ['Hello', 'name', 'John'] |
null | Construct a Fibonacci Heap class. | """ Construct a Fibonacci Heap class """ class FibonacciHeap: def __init__(self): self.min = None self.nodes = [] def insert(self, node): self.nodes.append(node) if self.min is None or node.key < self.min.key: self.min = node def extract_min(self): min_node = self.min self.min = None return min_node if __name__ == '__m... | |
null | Create a Python script to format the following string with proper new lines and indentation. | '{ "name":"John", "age":30, "city":"New York"}' | formatted = '{\n "name":"John",\n "age":30,\n "city":"New York"\n}' |
null | Create a Python program to generate random passwords of 8 alphanumeric characters. | import string
import random
def generate_password():
letters = string.ascii_letters + string.digits
return ''.join(random.choice(letters) for i in range(8)) | |
null | Develop a code to rotate a given list by a given value. | my_list = [1, 2, 3, 4, 5] k = 3 | def rotate_list(my_list, k): """ A function to rotate a given list by a given value. Input: list, integer Output: list """ # Get the length of list length = len(my_list) # Rotate the list rotated = my_list[-k % length:] + my_list[:-k % length] return rotated |
[DE Wikipedia] Haltestelle Wien Unter-Döbling
Die Haltestelle Wien Unter-Döbling im 19. Wiener Gemeindebezirk Döbling war eine Haltestelle im Kreuzungsbereich Döblinger Hauptstraße / Hohe Warte / Barawitzkagasse / Ruthgasse / Nusswaldgasse. Trotz ihres Namens lag sie nicht in der Katastralgemeinde Unterdöbling, sonder... | null | null | null |
[EN Wikipedia] Aaron
According to Abrahamic religions, Aaron ( or ) was a prophet, a high priest, and the elder brother of Moses. Information about Aaron comes exclusively from religious texts such as the Hebrew Bible, the New Testament (Luke, Acts, and Hebrews), and the Quran. The Hebrew Bible relates that, unlike Mo... | null | null | null |
null | Construct a query in PostgreSQL to delete all the rows from a table. | DELETE FROM table_name; | |
[CS Wikipedia] Le Crotoy
Le Crotoy je francouzská obec v departementu Somme v regionu Hauts-de-France. V roce 2010 zde žilo 2 219 obyvatel. Vývoj počtu obyvatel Související články Seznam obcí v departementu Somme Externí odkazy Reference Obce v departementu Somme Přímořská letoviska ve Francii | null | null | null |
null | Generate a regex to check if a given string contains any vowels | let regex = /[aeiou]/i; | |
null | Make a program in Python that ensures that two dates provided by the user are within one year of each other. | date1 = "10-02-2020"
date2 = "11-02-2021" | from datetime import datetime
date1 = datetime.strptime(date1, "%d-%m-%Y")
date2 = datetime.strptime(date2, "%d-%m-%Y")
def within_year (date1, date2):
if abs((date2 - date1).days) <= 365:
return True
else:
return False
if within_year(date1, date2):
print("The two dates are within one year of each othe... |
null | Write a Python algorithm to find out whether a number is a palindrome or not. | def is_palindrome(n):
n_str = str(n)
rev_str = n_str[::-1]
if n_str == rev_str:
return True
else:
return False | |
[HI Wikipedia] सुंग जू यिंग
सुंग जू यिंग (, जन्म: 13 अगस्त 1966) चीनी गायक और चीन की कम्युनिस्ट पार्टी की सदस्य है। जीवनी सुंग गूज़ांग काउंटी, शियांशी तुजिया और मियाओ स्वायत्त दीचू, हूनान में पैदा हुई थी। वह मियाओ नस्ल की है। जब वो 12 साल की थी तभी उनके पिता का देहांत हो गया। 1991 में वह एक राष्ट्रीय प्रथम श्रेणी के ग... | null | null | null |
null | Create a Node.js script that logs a string. | const fs = require('fs'); // Logs the specified string function logString(str) { console.log(str); } logString('Log this string'); | |
null | Design a template system for generating emails using Python. | A JSON object containing the email's data | import re
import json
# Load the data from the JSON
with open('email_data.json') as f:
data = json.load(f)
# Create a template for the email
email_template = """
Dear {{ recipient }},
{{ greeting }},
{{ message }}
{{ signature }}
"""
# Compile the regex
pattern = re.compile(r'{{\s*(.*?)\s*}}')
# Function to for... |
[DE Wikipedia] Paris–Luxemburg 1964
Paris–Luxemburg 1964 war die 2. Austragung von Paris–Luxemburg, einem mehrtägigen Etappenrennen. Das Rennen wurde von Rik Van Looy vor Jean Stablinski und Edgard Sorgeloos gewonnen. Teilnehmende Mannschaften Etappenübersicht Ergebnisse Gesamtwertung Weblinks Paris–Luxembourg 1964 Ei... | null | null | null |
null | Create a class Employee with constructor to initialize the instance variables _name and _age | class Employee { private String _name; private int _age; public Employee(String name, int age) { this._name = name; this._age = age; } public String getName() { return _name; } public int getAge() { return _age; } } | |
null | Write a JavaScript function that accepts a string argument and returns its capitalized value. | function capitalize(str) { return str.charAt(0).toUpperCase() + str.slice(1); } | |
[HI Wikipedia] वेद
वेद, प्राचीन भारत वर्ष के पवित्र साहित्य हैं जो धरती के प्राचीनतम सनातन हिन्दुओं के प्राचीनतम और आधारभूत धर्मग्रन्थ भी हैं । वेद, विश्व के सबसे प्राचीन साहित्य भी हैं। भारतीय संस्कृति में वेद सनातन एवं वर्णाश्रम धर्म के मूल और सबसे प्राचीन ग्रन्थ है। 'वेद' शब्द संस्कृत भाषा के विद् धातु से बना है, ज... | null | null | null |
null | Create a class in Python which takes an employee name and salary as parameters and prints them. | Employee Name: John Smith, Salary: 5000 | class Employee:
def __init__(self, name, salary):
self.name = name
self.salary = salary
def print_employee_details(self):
print('Employee Name: {}, Salary: {}'.format(self.name, self.salary))
employee = Employee('John Smith', 5000)
employee.print_employee_details() |
null | Design a class in Java to represent a student, with their name and grade fields. | public class Student { String name; String grade; public Student(String name, String grade) { this.name = name; this.grade = grade; } public String getName() { return this.name; } public String getGrade() { return this.grade; } } | |
null | Isolate all the comments from a given piece of code | def square(x): # return square of x return x * x | # return square of x |
null | Create a method in JavaScript that will return the area of a triangle. | // Calculating area of triangle in JavaScript function areaOfTriangle(a, b, c) { // Calculate the semi-perimeter of the triangle var s = (a + b + c) / 2; // Calculate the area of triangle using Heron's Formula var area = Math.sqrt(s * (s - a) * (s - b) * (s - c)); // Return the area of triangle return area; } | |
[DE Wikipedia] Karl-Heinz Thomas (Schauspieler)
Karl-Heinz Thomas (* 15. Februar 1937 in Hannover) ist ein deutscher Schauspieler bei Bühne, Film und Fernsehen. Leben und Wirken Thomas erhielt eine Ausbildung zum Sänger und Schauspieler. Seine künstlerische Laufbahn startete er 1959 als Bassbuffo im Chor von Münster. ... | null | null | null |
null | Create a Python script to extract emails from a given string. | "Alice lives at alice@example.com and Bob lives at bob@example.com." | import re
input_str = "Alice lives at alice@example.com and Bob lives at bob@example.com."
# use regular expression to extract emails
pattern = r'[\w\.-]+@[\w\.-]+'
emails = re.findall(pattern, input_str)
print(emails) # ['alice@example.com', 'bob@example.com'] |
null | How do you connect to a MySQL database in Python? | You can connect to a MySQL database in Python using the mysql.connect() method. The syntax of this method is as follows: mysql.connect(host="localhost", user="username", password="password", database="database_name") Once you have successfully connected to the MySQL database, you can run SQL queries or perform other op... | |
null | Create a web crawler in Python that collects data from specific pages. | https://en.wikipedia.org/wiki/Python_(programming_language) | import requests
from bs4 import BeautifulSoup
url = "https://en.wikipedia.org/wiki/Python_(programming_language)"
r = requests.get(url)
soup = BeautifulSoup(r.content)
# get page title
title = soup.find('h1', attrs={'id': 'firstHeading'}).text
# get all div nodes with class
divs = soup.find_all('div', class_='mw-bo... |
null | Write a function in Java for calculating the Modified Julian Date for a given date. | public double calculateModifiedJulianDate(String date) { int year = Integer.parseInt(date.substring(0, 4)); int month = Integer.parseInt(date.substring(5, 7)); int day = Integer.parseInt(date.substring(8, 10)); int hour = Integer.parseInt(date.substring(11, 13)); int minute = Integer.parseInt(date.substring(14, 16)); i... | |
[EN Wikipedia] Taharua River
The Taharua River is a river of the northwestern Hawke's Bay region of New Zealand's North Island. It flows south from its origins 25 kilometres southwest of Taupō to reach the Mohaka River of which it is one of the earliest tributaries. See also List of rivers of New Zealand References Ri... | null | null | null |
null | Generate a correct python program to perform linear regression. | import numpy as np
def linear_regression(X, y):
X_b = np.array([np.ones(X.shape[0]), X]).T
theta = np.linalg.inv(X_b.T @ X_b) @ X_b.T @ y
return theta | |
[DE Wikipedia] Harald Stenger
Harald Stenger (* 13. Februar 1951 in Frankfurt-Bornheim, Hessen) ist ein deutscher Sportjournalist und ehemaliger Pressesprecher beim Deutschen Fußball-Bund. Karriere Stenger begann seine journalistische Karriere schon während seiner Schulzeit als freier Mitarbeiter in der Sportredaktion... | null | null | null |
null | Create a Python program to group elements of a list based on their length. | ['cat', 'dog', 'apple'] | def groupByLength(arr):
result = {}
for word in arr:
if len(word) in result:
result[len(word)].append(word)
else:
result[len(word)] = [word]
return result
groupedByLength = groupByLength(['cat', 'dog', 'apple'])
print(groupedByLength) |
null | Create a program to calculate the standard deviation of an array of numbers. | arr = [10, 8, 12, 5, 9] | def stdev(arr): n = len(arr) mean = sum(arr) / n variance = sum((x - mean) ** 2 for x in arr) / n return (variance ** 0.5) |
null | Write a Python program to access an item of a list. | list1 = [1, 2, 3, 4, 5]
item_index = 3 | list1 = [1, 2, 3, 4, 5]
item_index = 3
def access_list_item(my_list, index):
return my_list[index]
result = access_list_item(list1, item_index)
print(result) |
null | Create a python module that reads the sentiment of a given text. | Nothing | import nltk
from nltk.sentiment.vader import SentimentIntensityAnalyzer
def sentiment_score(text):
sentiment_scores = SentimentIntensityAnalyzer().polarity_scores(text)
return sentiment_scores["compound"] |
[EN Wikipedia] Gmina Borowie
Gmina Borowie is a rural gmina (administrative district) in Garwolin County, Masovian Voivodeship, in east-central Poland. Its seat is the village of Borowie, which lies approximately north-east of Garwolin and south-east of Warsaw. The gmina covers an area of , and as of 2006 its total po... | null | null | null |
null | Design a Python function that rearranges the elements of a given array | [1, 2, 3, 4, 5] | def rearrange_arr(arr):
arr.sort(reverse = True)
return arr |
[HI Wikipedia] १७ सितम्बर
17 सितंबर ग्रेगोरी कैलंडर के अनुसार वर्ष का 260वॉ (लीप वर्ष में 261 वॉ) दिन है। साल में अभी और 105 दिन बाकी है। प्रमुख घटनाएँ 1922- डच साइकिल चालकपीट मोस्कप्स विश्व चैंपियन बना। 1923 - बर्कले में भड़की आग ने कैलिफोर्निया में भीषण तबाही मचायी। इसमें कैलिफोर्निया विश्वविद्यालय के परिसर के उत्तर... | null | null | null |
null | Design an algorithm in Python to sort an array of strings alphabetically. | def sort_strings_alphabetically(arr):
arr.sort(key=str.lower)
return arr | |
null | Write a code to construct a new array with the elements reversed. | arr = [1, 2, 3, 4, 5] | def reverse_array(arr): """ Construct a new array with the elements reversed. """ new_arr = [] for i in range(len(arr)-1, -1, -1): new_arr.append(arr[i]) return new_arr |
null | Design an algorithm in Python to traverse a 2D array top-down and left-right and output its contents as a single array. | [[1,2,3], [4,5,6], [7,8,9]] | def traverse2DArray(arr):
output = []
for i in range(len(arr)):
for j in range(len(arr[0])):
output.append(arr[i][j])
return output
print(traverse2DArray([[1,2,3], [4,5,6], [7,8,9]])) # [1,2,3,4,5,6,7,8,9] |
[DE Wikipedia] Santos FC Ouagadougou
Santos Football Club ist ein Sportverein in Ouagadougou (Burkina Faso). Der 1977 gegründete Verein gewann dreimal die Meisterschaft der zweiten Division des Landes. Aufgrund der prekären finanziellen Situation des Klubs herrscht eine hohe Spielerfluktuation; junge vielversprechende... | null | null | null |
null | Create an MySQL table with four columns: "id", "name", "age", and "city". | CREATE TABLE table_name ( id int(11) NOT NULL AUTO_INCREMENT, name varchar(50) NOT NULL, age int(11) NOT NULL, city varchar(50) NOT NULL, PRIMARY KEY (id) ); | |
null | Generate a Python class to represent a deck of cards in a card game. | class Deck:
#constructor
def __init__(self):
self.cards = []
#function to create a deck of playing cards
def create_deck(self):
suits = ["C", "S", "H", "D"]
ranks = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"]
for suit in suits:
fo... | |
[CS Wikipedia] Slepičák
Slepičák je zástupce plemene holuba domácího, které je charakteristické zvětšením hrudi ptáka až do té míry, že se tvarem těla podobá slepici. Plemenná skupina slepičáků je nepočetná, avšak vyhraněná a jednotlivá plemena jsou si značně podobná. Jsou podobní užitkovým plemenům a stejně jako oni ... | null | null | null |
null | Explain the concept of the depth-first search algorithm and provide an example. | Depth-first search (DFS) is an algorithm used to traverse a tree or graph data structure. It starts at the root of the tree, explores as far as possible down a given branch and then backtracks along the same path before exploring a new branch. For example, consider a BST (Binary Search Tree) where we want to traverse a... | |
null | Describe the purpose of the ``await`` operator in an asynchronous JavaScript function. | The purpose of the "await" operator in an asynchronous JavaScript function is to pause the execution of the function until a Promise is resolved and to return the resolved value from the Promise. | |
null | Create a Python machine learning model that predicts the gender of the given data based on height and weight. | Height: 1.78m
Weight: 80kg | import pandas as pd
from sklearn.svm import SVC
from sklearn.model_selection import train_test_split
# Build dataset
data = [[1.78, 80, "male"], [1.69, 55, "female"], [1.68, 65, "female"], [1.68, 70, "male"], [1.73, 68, "female"]]
df = pd.DataFrame(data, columns=['height', 'weight', 'gender'])
# Split data
X = df[['... |
[EN Wikipedia] Bally Manufacturing
Bally Manufacturing, later renamed Bally Entertainment, was an American company that began as a pinball and slot machine manufacturer, and later expanded into casinos, video games, health clubs, and theme parks. It was acquired by Hilton Hotels in 1996. Its brand name, and mid-20th c... | null | null | null |
null | Create a function to sort a given set of strings in dictionary order. | def sort_dict(arr): arr.sort(key=lambda s: [s.lower(), s]) return arr | |
null | Write a Python program to optimize the following code to reduce its time complexity. | def isPrime(n):
for i in range(2, n):
if n % i == 0:
return False
return True | def isPrime(n):
"""
This function takes a number and checks if it is a prime number
Args:
n: an integer
Returns:
true if number is prime, false otherwise
"""
# Edge case: 1 is not a prime number
if n <= 1:
return False
# Check from 2 to the square root of number
for i in range(2, int(ma... |
null | To start pyHegel, import the module and call the function start_pyHegel(). If starting on Windows with the Console program, call start_console() instead. | # -*- coding: utf-8 -*-
########################## Copyrights and license ############################
# #
# Copyright 2011-2015 Christian Lupien <christian.lupien@usherbrooke.ca> #
# ... | |
[DE Wikipedia] Gold Stick
Gold Stick ist die Bezeichnung für einen Bediensteten am Hof des britischen Monarchen. Das Amt existiert seit der Tudor-Zeit, als zwei Offiziere zu persönlichen Leibwachen des Souveräns ernannt wurden und diesen Titel bekamen. Seit der Regentschaft von Königin Victoria sind die Aufgaben rein ... | null | null | null |
[DE Wikipedia] Fuad Hassan
Fuad Hassan (* 26. Juni 1929 in Semarang; † 7. Dezember 2007 in Jakarta) war ein indonesischer Politiker. Leben Hassan hat an der Universitas Indonesia Psychologie studiert. Später fungierte er als Botschafter seines Landes in Ägypten. Von 1985 bis 1993 war er im vierten und fünften Kabinett... | null | null | null |
[EN Wikipedia] Barbara Slate
Barbara Slate (born May 9, 1947) is an American artist, cartoonist, graphic novelist, comic book creator, and writer. She is one of the few female artists who has created, written, and drawn comics for both DC and Marvel Comics. Her textbook, You Can Do a Graphic Novel, was first published... | null | null | null |
[EN Wikipedia] Actrius
Actresses (Catalan: Actrius) is a 1997 Catalan language Spanish drama film produced and directed by Ventura Pons and based on the award-winning stage play E.R. by Josep Maria Benet i Jornet. The film has no male actors, with all roles played by females. The film was produced in 1996. Synopsis In... | null | null | null |
null | Create an object-oriented program in Python to calculate the total cost of an array of products. The program should include a Product class with fields for name, price, and quantity. | [
{name: "Apple", price: 1.99, quantity: 2},
{name: "Banana", price: 0.79, quantity: 5}
] | class Product:
def __init__(self, name, price, quantity):
self.name = name
self.price = price
self.quantity = quantity
def calculateTotalCost(products):
totalCost = 0
for product in products:
totalCost += product.price * product.quantity
return totalCost
products = [
Product("Apple", 1.99, 2),
Pr... |
null | Create a function that creates a tuple of the given arguments and returns the tuple. | a="A" b="B" | def create_tuple(a, b): return (a, b) |
null | Create a class to represent a complex number with two private fields (x, y) and two public member functions (getMagnitude, increment) in Java. | public class ComplexNumber { private double x; private double y; public ComplexNumber(double x, double y) { this.x = x; this.y = y; } public double getMagnitude() { return Math.sqrt(x * x + y * y); } public void increment() { this.x++; this.y++; } } | |
null | Create a program to create a dictionary with words and their frequencies from a given sentence. | sentence = "Python is an easy, powerful language with a simple syntax and high readability" | def create_dict(sentence): words = sentence.split() res = {} for word in words: res[word] = words.count(word) return res # Output {'Python': 1, 'is': 1, 'an': 1, 'easy,': 1, 'powerful': 1, 'language': 1, 'with': 1, 'a': 1, 'simple': 1, 'syntax': 1, 'and': 1, 'high': 1, 'readability': 1} |
null | Create a MySQL query to print all records from a specific table in descending order of their id. | SELECT * FROM table_name ORDER BY id DESC; | |
null | Write a `PHP` script to sort an associative array based on its values. | $data = array("John"=>45, "Bob"=>67, "Ann"=>55); | function sortByValue($data) { asort($data); return $data; } |
null | The code is a Python script that checks for the latest episode of Bigg Boss 8 on colors.in.com. To use the script, run it from the command line with optional arguments for a custom search pattern or verbose output. The script will send a request to the server, get the page data as a string, and search for the latest ep... | #!/usr/bin/env python3
#
# Copyright (c) 2014 Shubham Chaudhary <me@shubhamchaudhary.in>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at you... | |
null | Create a python function that takes two inputs as a string and returns their concatenated output. | String a = 'Hello'
String b = 'World' | def concat(a,b):
return a+b |
null | Compose a query in MySQL to filter records from a table where the name contains "John". | SELECT * FROM table WHERE name LIKE '%John%'; | |
[CS Wikipedia] Ladislav Prášil
Ladislav Prášil (* 17. května 1990 Šternberk) je český atlet, vrhač. Je dvojnásobným držitelem bronzové medaile z halového mistrovství Evropy. Sportovní kariéra Rodák ze Šternberka začínal s atletikou v klubu AK Olomouc pod vedením Viktora Znojila. V roce 2010 přešel do Prahy do atletick... | null | null | null |
[HI Wikipedia] मनोहर श्याम जोशी
मनोहर श्याम जोशी 1933- (देहांत: मार्च ३०, २००६) आधुनिक हिन्दी साहित्य के श्रेष्ट गद्यकार, उपन्यासकार, व्यंग्यकार, पत्रकार, दूरदर्शन धारावाहिक लेखक, जनवादी-विचारक, फिल्म पट-कथा लेखक, उच्च कोटि के संपादक, कुशल प्रवक्ता तथा स्तंभ-लेखक थे। दूरदर्शन के प्रसिद्ध और लोकप्रिय धारावाहिकों- ' बुन... | null | null | null |
null | Create code that, given a string, returns the longest permutation of the same character | str = "abcccdef" | def longest_consecutive_character(str): # Store character, length of longest permutation, and current length max_char = str[0] max_length = 1 cur_length = 1 # Iterate over the string for i in range(1, len(str)): # If the characters are the same if str[i] == str[i-1]: cur_length += 1 # Check if the current permutation i... |
null | Construct a code to filter a string for only numerical characters in Python. | "4x4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s" | def filter_string(string):
filtered_string = ''
for c in string:
if c.isdigit():
filtered_string += c
return filtered_string
print(filter_string("4x4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s4s")) |
null | Complete the following bash script with conditional statements. | #!/bin/bash echo " Enter an integer " read num | #!/bin/bash echo "Enter an integer" read num if (( num > 0 )); then echo "The number is positive" elif (( num < 0 )); then echo "The number is negative" else echo "The number is zero" fi |
null | Create a JavaScript class to represent an Employee object | class Employee { constructor(name, age, salary) { this.name = name; this.age = age; this.salary = salary; } } | |
null | Develop a Python class which allows users to access and control additional hardware components which are connected to the computer. | # Import necessary libraries
import sys, serial
class HardwareController:
"""
This class allows users to access and control additional hardware components which are connected to the computer via USB.
"""
def __init__(self):
self.serial_port = None
self.baud_rate = None
# Establish... | |
null | Use the reduce() method to sum the values of an array of numbers in JavaScript. | const numbers = [1, 2, 3, 4, 5]; | let sum = numbers.reduce((total, num) => total + num); console.log(sum); // 15 |
null | Write a Python program to find all the Armstrong numbers between the given two numbers. An Armstrong number is a number such that the sum of its digits raised to the third power is equal to the number itself. | lower = 100 upper = 2000 | def isArmstrong(num): s = 0 temp = num while temp > 0: digit = temp % 10 s += digit ** 3 temp //= 10 if num == s: return True else: return False for num in range(lower, upper + 1): if isArmstrong(num): print(num) |
null | Design an AI system in Python to classify articles into 5 different classes. | The input dataset contains 3000 articles. | import nltk
from nltk.tokenize import word_tokenize
import sklearn
# load data
articles = [<input dataset>]
labels = [<ground truth classes>]
# create training and test datasets
X_train, X_test, y_train, y_test = train_test_split(articles, labels, test_size=0.25, random_state=42)
# prepare datasets for vectorization... |
null | Develop a code to check if a given array is sorted or not. | [1, 2, 4, 3] | def is_sorted(array): for i in range(len(array)-1): if array[i] > array[i+1]: return False return True |
null | Write a Python program to group a list of numbers based on their modulo with a given number. | list_numbers = [2, 6, 8, 10, 3, 7]
num = 3 | def group_modulo(list_numbers, num):
result = {i:[] for i in range(num)}
for number in list_numbers:
result[number % num].append(number)
return result
result = group_modulo(list_numbers, num)
print(result) |
null | Write a single line of code to remove an item from a list. | my_list = [1, 2, 3, 4] | my_list.remove(4) |
null | Develop a Python program that prints "Hello, World!" whenever it is run. | #Python program to print "Hello World!"
print("Hello, World!") | |
null | Create a class in Python to store student details with the name and age data. | class Student:
def __init__(self, name, age):
self.name = name
self.age = age | |
null | Create a Python program to check if a given string can be formed from a given set of words. | String: "justdoit"
Set of words: ["just", "do", "it"] | def word_set(string, words):
words_set = set(words)
string_set = set(string)
if string_set.issubset(words_set):
return True
else:
return False
word_set("justdoit", ["just", "do", "it"]) |
[DE Wikipedia] Queen Maud Gulf
Der Queen Maud Gulf ist ein arktisches Gewässer vor der Nordküste von Nordamerika. Es liegt in der Region Kitikmeot im kanadischen Territorium Nunavut. Geographie Der Golf befindet sich zwischen dem amerikanischen Festland im Süden, der King William Island im Nordosten und der Victoria I... | null | null | null |
null | Use a machine learning algorithm to classify emails into two categories: junk and non-junk using Python. | from sklearn.naive_bayes import MultinomialNB
# Load training data
X_train = ...
y_train = ...
# Create classifier
clf = MultinomialNB()
# Train the classifier
clf.fit(X_train, y_train)
# Make predictions
y_predicted = clf.predict(X_test) | |
[HI Wikipedia] गुआंगज़ौ एबगरआनद
गुआंगज़ौ एबगरआनद एक पेशेवर फुटबॉल क्लब गुआंगज़ौ, गुआंग्डोंग, चीन और भी चीनी सुपर लीग चैंपियन में आधारित है। टएनहअ स्टेडियम घर क्लब है। | null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.