text
stringlengths
141
2.89k
⌀
instruction
stringlengths
19
1.5k
⌀
input
stringlengths
0
800
⌀
output
stringlengths
1
2.5k
⌀
null
Create an HTML code that renders a checkbox with the text "Remember me" next to it.
<input type="checkbox" name="remember" value="yes"> Remember me
null
Create a machine learning model in Python that predicts the product popularity based on the customer reviews.
Data set containing customer reviews and sales volumes
# import libraries import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model import LogisticRegression # read data data = pd.read_csv('data.csv') # split data into features and labels X = data['cu...
null
Create a JavaScript object for a square with sides 8, 10 and 12.
let objSquare = { side1: 8, side2: 10, side3: 12 }
null
Compute the edits between two strings.
str1 = "I am eating" str2 = "I am eating a sandwich"
def edit_distance(str1, str2): """ Compute the edit distance between two strings """ m = len(str1) n = len(str2) distance = [[0 for i in range(n+1)] for j in range(m+1)] for i in range(m+1): for j in range(n+1): # If first string is empty, only option is to insert all characters of second string if i == 0: distance[i][...
null
Research and write a report on the current state of the Python programming language.
Python is an interpreted, high-level programming language developed by Dutch programmer Guido Van Rossum in 1991. It has a comprehensive and large standard library, and a very easy-to-learn and widely used syntax. Python is commonly used in many areas of scientific computing and is widely used in web and software devel...
null
Create a program in JavaScript to calculate the area of a triangle with given side lengths.
side_1 = 10 side_2 = 10 side_3 = 8
let side_1= 10; let side_2= 10; let side_3= 8; //calculate the permiter of triangle let perimiter = (side_1 + side_2 + side_3)/2; //calculate the area of triangle using Heron's formula let area = Math.sqrt(perimiter*(perimiter-side_1)*(perimiter-side_2)*(perimiter-side_3)); console.log(area);
null
Write a Python program to parse the given HTML data and print out each HTML tag.
<html> <head> <title>Parse HTML</title> </head> <body> <h1>Header</h1> <p>This is a paragraph</p> <h2>Sub-header</h2> </body> </html>
import re # Regex to match HTML tags pattern = re.compile('<[^>]+>') # Input HTML data html = """ <html> <head> <title>Parse HTML</title> </head> <body> <h1>Header</h1> <p>This is a paragraph</p> <h2>Sub-header</h2> </body> </html> """ # Match and print all HTML tags print('HTML Tags:') for tag in...
null
Create a React component that renders a list of items.
items = ["Apple", "Banana", "Cherry"]
import React from 'react'; const ListView = (props) => { return ( <div> { props.items.map((item, index) => ( <li key={index}>{item}</li> )) } </div> ); } export default ListView;
[CS Wikipedia] Situace (edice) Situace byla edice publikací o výtvarném umění, kterou vydávala Jazzová sekce Svazu hudebníků v sedmdesátých a osmdesátých letech 20. století. Edici řídil Karel Srp mladší. Publikace měly jednotnou grafickou úpravu, jejímž autorem byl Joska Skalník, formát A4 a rozsah 20 stran černobíléh...
null
null
null
[CS Wikipedia] Překlady slovanských literatur Překlady slovanských literatur () vznikly v roce 2009 v Ústavu slovanské filologie na Filologické fakultě Slezské univerzity v Katovicích, nejprve jako kontinuálně vydávaná publikace. V rámci jiho- a západoslovanských jazyků jsou věnovány otázkám uměleckého překladu, jež j...
null
null
null
null
Edit this code to sort a list of strings alphabetically
mylist = ["Eggs", "Cheese", "Milk"]
mylist.sort()
null
Write a Python program to implement a sorting algorithm (your choice).
num_list = [5,2,1,9,7,8]
def sorting_algorithm(num_list): for i in range(len(num_list)): for j in range(i + 1, len(num_list)): if num_list[i] > num_list[j]: num_list[i], num_list[j] = num_list[j], num_list[i] return num_list
null
Modify the following code to print out "The result is 30".
int a = 10 int b = 20 Console.WriteLine("The result is " + a + b)
int a = 10; int b = 20; Console.WriteLine("The result is " + (a + b).ToString());
null
Create a REST API endpoint to retrieve specific user data from the database
A relational database with a user table containing: user_id, email, phone_number
@app.route('/user', methods=['GET']) def get_user(): user_id = request.args.get('user_id') user = db.execute('SELECT * FROM user WHERE user_id = ?', (user_id,)).fetchone() if user is None: `. abort(404) return jsonify(user)
null
Create a program using C++ to check whether a given number is a prime number.
15
int n = 15; bool prime = true; for(int i = 2; i < n; i++) { if (n % i == 0) { prime = false; break; } } if (prime) { cout << "The number is prime"; } else { cout << "The number is not prime"; }
null
Utilizing the Java syntax, write a code snippet to find the maximum value in the given array.
[4, 15, 11, 26, 2]
int max = arr[0]; for (int i = 1; i < arr.length; i++) { if (arr[i] > max) { max = arr[i]; } } System.out.println("Maximum value is: " + max);
null
Formulate an algorithm to evaluate a given sudoku board in Python.
board = [[3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6, 3, 0, 0, 5], [0, 5, 0, 0, 9, 0, 6, 0, 0], [1, 3, 0, 0, 0, 0, 2, 5, 0], [0, 0, 0, 0, 0, 0, 0, 7, 4], [0, 0, ...
def evaluate_suduku(board): rows = len(board) cols = len(board[0]) # Check rows for row in board: if not all_unique(row): return False # Check columns for i in range(cols): column = [row[i] for row in board] if not all_unique(column): return False ...
[EN Wikipedia] Tom Banks (rugby union, born 1994) Tom Banks (born 18 June 1994) is an Australian professional rugby player who currently plays for the in the Super Rugby. He has represented Australia in international rugby. Banks started his Super Rugby career with the Queensland Reds in 2015. He has played in the Nat...
null
null
null
null
What data structure would be best to store an employee roster containing their name, age, and gender?
The best data structure for storing an employee roster containing their name, age, and gender would be a hash table. A hash table is a data structure that allows for fast lookups and inserts by mapping values to keys. Each employee can be stored as a key-value pair, with their name, age, and gender as the respective va...
null
Generate a crypto wallet address using Python.
from web3 import Web3 from web3.personal import Personal # Create a Web3 instance to use w3 = Web3(Web3.EthereumTesterProvider()) # Create a Personal instance to use personal = Personal(w3) # Generate a new wallet address address = personal.newAccount('my_wallet_password') print(address) # Output: 0x...
null
How can we check the type of a variable in JavaScript?
We can check the type of a variable in JavaScript using the typeof operator. For example, to check the type of the variable x, we can use the following code: var x = 10; console.log(typeof x); // outputs "number"
null
Generate code to create an array of 5 random integers between 0 and 10.
arr = []; for(let i=0; i<5; i++){ arr.push(Math.floor(Math.random() * 11)); } // Result: arr = [4, 6, 8, 2, 9]
null
Given a large text, write a Python script to find common phrases.
"In the morning, the sun rises in the east and sets in the west. In the evening, the stars come out and shine in the night sky. The moon rises in the east and sets in the west."
import re # input string string = "In the morning, the sun rises in the east and sets in the west. In the evening, the stars come out and shine in the night sky. The moon rises in the east and sets in the west." words = string.split(" ") # set that contains the frequnt phrases phrases = set() # loop over the words ...
[CS Wikipedia] Modřanka Tower Modřanka Tower je výškový bytový dům nacházející se v Modřanech na Praze 4. Má 15 nadzemních podlaží a přibližně 70 bytů. K dokončení došlo v roce 2019. Je součástí developerského projektu areálu Modřanka zahrnující 292 bytů. Jeho architektonický návrh vytvořilo studio LOXIA, investorem j...
null
null
null
null
Write a Python function that takes an array of numbers as an argument and returns the largest prime factor of the product of the numbers in the array.
[12, 10, 15]
def largest_prime_factor(arr): import math product = 1 for num in arr: product *= num largest_factor = -1 for i in range(2, math.floor(math.sqrt(product))+1): while product % i == 0: product = product / i largest_factor = i if largest_factor == -1: return product else: return largest_...
[EN Wikipedia] Gaten Matarazzo Gaetano John Matarazzo III (; ; born September 8, 2002) is an American actor. He began his career on the Broadway stage as Benjamin in Priscilla, Queen of the Desert (2011–12) and as Gavroche in Les Misérables (2014–15). Matarazzo gained recognition for playing Dustin Henderson in the Ne...
null
null
null
[DE Wikipedia] -itz -itz ist eine Ortsnamenendung mit slawischem Ursprung. Herkunft Die Ortsnamen auf -(i)(t)z sind aus unterschiedlichen slawischen Ortsnamentypen entstanden. slawische Bewohnernamen mit -ici als Endung (vgl. Sorbisch -icy bzw. -ecy) Putdargoniz (1198 in Mecklenburg erwähnt), entstanden aus einem reko...
null
null
null
null
Create a Python program to parse a CSV string and print each row in a readable format.
CSVString = "John Doe, 22, ABC Street, 07777\nMary Smith, 26, XYZ Street, 02222"
import csv csvString = "John Doe, 22, ABC Street, 07777\nMary Smith, 26, XYZ Street, 02222" # Convert CSV String to List csvList = csvString.split('\n') # Print each Row of CSV for row in csvList: print(row)
null
Convert this string from snake_case to CamelCase.
snake_case_string = "example_string"
camelCaseString = ''.join(x.capitalize() or '_' for x in snake_case_string.split('_'))
null
Create a Python program that takes a positive integer as input and returns the closest Fibonacci number.
Not applicable
def closest_fibonacci(number): a, b = 0, 1 while b < number: a, b = b, a + b return a number = int(input('Enter a positive integer: ')) print("The closest Fibonacci number is", closest_fibonacci(number))
null
Write a web crawler using Python Scrapy which starts from a URL and follows all the hyperlinks on the page until a given depth is reached.
The URL to start the crawl and a maximum depth of two levels.
import scrapy from scrapy.spiders import CrawlSpider, Rule from scrapy.linkextractors import LinkExtractor class MySpider(CrawlSpider): name = 'crawler' allowed_domains = ['example.com'] start_urls = ['http://example.com/'] rules = [ Rule(LinkExtractor(allow=()), follow=True, callback='parse_item', process_link...
[DE Wikipedia] Tadschikischer Nationalpark Der Tadschikische Nationalpark, auch Pamir-Nationalpark, ist ein geschütztes Gebiet im Pamirgebirge im östlichen Teil von Tadschikistan. Er umfasst eine Fläche von insgesamt 26.000 km². Das Gebiet wurde 1992 durch Tadschikistan zum Nationalpark erklärt und im Jahr 2013 in die...
null
null
null
null
Create an array of numbers and check if a given number exists in the array. Output true if it exists, output false if it does not.
arr = [1,2,3,4,5] n = 4
true
[HI Wikipedia] रमेश भाई ओझा रमेश भाई ओझा एक आध्यात्मिक हिन्दू धर्मोपदेशक हैं, जो वेदान्त दर्शन पर धाराप्रवाह व्याख्यान देते हैं। उनकी रामकथा सुनने भारी संख्या में श्रोता पहुँचते हैं। गुजरात के देवका में पैदा हुए रमेश भाई ने अपनी जन्मभूमि में देवका विद्यापीठ की स्थापना की है। इस विद्यापीठ में भारतीय गुरुकुल परम्परा के ...
null
null
null
null
Sort the following array
arr = [4, 2, 3, 5, 1]
arr.sort() print(arr)
[DE Wikipedia] Scott Halberstadt Scott Halberstadt (* 17. August 1976 in Connersville, Indiana) ist ein US-amerikanischer Schauspieler. Halberstadt absolvierte die Connersville High School. Er war von 2000 bis 2010 als Schauspieler in Hollywood tätig. Bekannt wurde er durch die Rolle des Nerds Eric in der Fernsehserie...
null
null
null
[DE Wikipedia] Benken BL Benken war eine Gemeinde des Bezirks Arlesheim des Kantons Basel-Landschaft in der Schweiz. Am 1. Januar 1972 wurde Benken mit der Gemeinde Biel zur Gemeinde Biel-Benken fusioniert. Bereits seit dem 16. Jahrhundert haben Biel und Benken eine gemeinsame Bürger-, Schul- und Kirchgemeinde, und au...
null
null
null
[HI Wikipedia] ग्रहण ग्रहण एक खगोलीय घटना है जो तब होती है जब कोई खगोलीय पिण्ड या अंतरिक्ष यान अस्थायी रूप से किसी अन्य पिंड की छाया में आता है या उसके और दर्शक के बीच कोई अन्य पिंड आ जाता है । तीन आकाशीय पिंडों का यह एक सीध में आना युति वियुति रूप में जाना जाता है। युति वियुति के अलावा, ग्रहण शब्द का उपयोग तब भी किया...
null
null
null
null
Implement an algorithm in Python which can sort an array of numbers in ascending order.
def insertion_sort(arr): #Iterationg through the array for i in range(1, len(arr)): key = arr[i] j = i-1 while j >= 0 and arr[j] > key: arr[j + 1] = arr[j] j -= 1 arr[j + 1] = key return arr
[HI Wikipedia] योनशोपिंग लैन योनशोपिंग लैन (स्वीडी: Jönköpings län, अंग्रेज़ी: Jönköping) स्वीडन का एक लैन है। 'लैन' स्वीडन का उच्च-स्तरीय प्रशासनिक विभाग होता है, जिसे कभी-कभी 'काउंटी' भी कहते हैं। इन्हें भी देखें स्वीडन की काउंटियाँ सन्दर्भ योनशोपिंग लैन स्वीडन की काउंटियाँ स्वीडन
null
null
null
null
Given the different test scores in the list, calculate the GPA.
[('DS', 98), ('OS', 95), ('SE', 85), ('ML', 80)]
GPA: 89.25
null
Write a python program to detect the facial expressions of a person using the OpenCV library.
Not applicable
import cv2 # load the cascade classifier face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml") # Read the input image img = cv2.imread("input.jpg") # Convert to grayscale gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # Detect the faces faces = face_cascade.detectMultiScale(gray_img, scaleFa...
[CS Wikipedia] Wikipedie Wikipedie (anglicky a v mnoha dalších jazycích Wikipedia) je mnohojazyčná online encyklopedie vytvořená a udržovaná jako projekt otevřené spolupráce se svobodným (otevřeným) obsahem, na jejíž tvorbě spolupracují dobrovolní přispěvatelé z celého světa. Využívá wiki redakční systém a je to nejvě...
null
null
null
null
Create a Python library to implement a common algorithm.
import math def algorithm(input1, input2): # Algorithm logic here return output
null
Create a program that checks for duplicates in a list and removes them.
def remove_duplicates(lst): res = [] for ele in lst: if ele not in res: res.append(ele) return res
null
Create a CSS rule for a class called "main-text" which sets the font weight of the text to bold and the font color to blue.
.main-text { font-weight: bold; color: blue; }
null
Using the given list, create a new variable "result" that stores the sum of all the elements.
items = [1, 2, 3, 4, 5]
result = 0 for item in items: result += item
null
Modify the code for the given purpose
string = input("Enter a string: ")
string = input("Enter a string: ") if not string.isalpha(): print("Input must contain only letters")
null
Compile the following code to JavaScript and return the compiled code.
function myFunc(a, b) { return a + b; }
function myFunc(a, b) { return a + b; } //Compiled Version const myFunc = (a, b) => a + b;
[HI Wikipedia] बयान-ओलगी प्रांत बयान-ओलगी (मंगोल: Баян-Өлгий; अंग्रेज़ी: Bayan-Ölgii) मंगोलिया के सुदूर पश्चिम में स्थित उस देश का एक अइमग (यानि प्रांत) है। यहाँ कज़ाख़ लोग बहुसंख्या में हैं और यह मंगोलिया का एकमात्र मुस्लिम व कज़ाख़ बहुसंख्यक प्रांत है। इस प्रांत की स्थापना १९४० में हुई थी। बयान-ओलगी प्रांत के कुछ नज...
null
null
null
[CS Wikipedia] Bucharský bublák Bucharský bublák je velice staré plemeno holuba domácího pocházející z jihozápadní Asie. Náleží do plemenné skupiny bubláků, což jsou holubi, u kterých se vyvinul specifický hlasový projev, tzv. bublání. Vrkání je modifikováno do déletrvajícího zvuku připomínajícího vzdálené zurčení pot...
null
null
null
null
Compose a function in C to display the result of raising a number to a positive power
int power(int k, int n) { int result = 1; while (n > 0) { result *= k; n--; } return result; }
null
Generate a program to get the min and max values from a list in one line.
def get_min_max(lst): return min(lst), max(lst)
[HI Wikipedia] अर्गाइल पिंक जुबली अर्गाइल पिंक जुबली () ऑस्ट्रेलिया में खुदाई से प्राप्त बगैर तराशा हुआ अब तक का सबसे बड़ा गुलाबी हीरा है। इस हीरे को वेस्टर्न ऑस्ट्रेलिया के रियो टिण्टो आर्गाइल हीरा खदान में पाया गया है। आमतौर पर आर्गाइल पिंक जुबली जैसे कीमती पत्थर या तो किसी अजायबघर में रख दिये जाते हैं या क्रिस्टी'ज...
null
null
null
null
Generate a unique ID in Python for a given string.
string = "Hello World!"
import uuid unique_id = uuid.uuid3(uuid.NAMESPACE_DNS, string)
null
Reverse the order of the given array without using inbuilt functions.
nums = [12, 23, 34, 45]
# Function to reverse the order of the given array def reverse_array(nums): # Variable to store the result result = [] # Iterate over the provided array starting from the last element for i in range(len(nums) -1, -1, -1): # Append each number to the result array result.append(nums[i]) # Return the result array return r...
[CS Wikipedia] Luboš Patera Luboš Patera (10. dubna 1963 Kladno – 11. listopadu 2020) byl občanský aktivista bojující za práva dětí v Česku a na Slovensku. Působil v občanském sdružení pro ochranu práv dětí, rodičů a prarodičů – Iustin. Šlo o jednoho z prvních otců, kteří uspěli se svojí žalobou proti České republice ...
null
null
null
null
Construct a code that takes a list of words as input and changes the case of each item in the list.
[cat, dog, apple]
def toUpperCase(words): upper_words=[] for word in words: upper_words.append(word.upper()) return upper_words if __name__ == "__main__": print(toUpperCase(['cat','dog','apple']))
[CS Wikipedia] Freestyle Freestyle je forma elektronické hudby, který vznikl na začátku 80. let ve Spojených státech. Popularita žánru přebývá až do dneška, především v portorických a italských komunitách. Historie Freestyle se vyvinulo v New Yorku a Miami na přelomu osmdesátých let jako fúze disca pozdějších sedmdesá...
null
null
null
null
Create a simple Python program to calculate the sum of two numbers and print out the result.
Number 1: 3 Number 2: 5
num1 = 3 num2 = 5 result = num1 + num2 print(f'The sum of {num1} and {num2} is {result}')
null
Generate a SQL query to update the job title for all the employees with name 'John'
UPDATE employees SET JobTitle = 'Software Engineer' WHERE Name = 'John'
null
What is a JavaScript Promise?
A JavaScript Promise is an object that represents the eventual completion of an asynchronous operation. A Promise object can be either resolved (successful) or rejected (failed). It provides a unified API for handling asynchronous operations, no matter when the operations are completed.
[DE Wikipedia] Patsy Reddy Dame „“ (* 17. Mai 1954 in , ) ist eine neuseeländische Rechtsanwältin und war von 2016 bis 2021 die 21. Generalgouverneurin von Neuseeland. Frühes Leben und Ausbildung wurde 1955 als Tochter des Ehepaars und in geboren. Ihre Eltern waren beide Lehrer. Sie wuchs zunächst in und später in in ...
null
null
null
[EN Wikipedia] We Rule the Night We Rule the Night is the fourth studio album by Swedish metalcore band Sonic Syndicate. The album was released on August 27, 2010 through Nuclear Blast and was produced by Toby Wright. We Rule the Night is the first full-length release by the band to feature the vocals of Nathan James ...
null
null
null
[EN Wikipedia] Net foreign assets In economics, the concept of net foreign assets relates to balance of payments identity. The net foreign asset (NFA) position of a country is the value of its net claims on the rest of the world (RoW), i. e. the value of the assets that country owns abroad, minus the value of the dome...
null
null
null
null
Describe in Python a custom exception for handling database connection errors.
class DBConnectionError(Exception): def __init__(self, message): self.message = message def __str__(self): return 'An Error Occured:\n\t' + self.message
null
Manually debug the following code to find any errors.
def foo(x): y = x**3 z = y + 2 return z
No errors found in the given code.
null
Rewrite this function using a recursive algorithm.
def factorial(n): result = 1 for i in range(1, n+1): result *= i return result
def factorial(n): if n == 0: return 1 else: return n * factorial(n-1)
[EN Wikipedia] Laura Angela Collins Laura Angela Collins is a London-based Irish Traveller activist and author. Early life Collins was born and raised in Bermondsey, London to Irish parents and attended the BRIT School for performing arts and technology. Her grandmother, Angelina Collins, renamed Angela, is buried in ...
null
null
null
null
Design a Python class structure for playing cards with two classes: Deck and Card.
class Deck: def __init__(self): self.cards = [] def populate(self): suits = ['Hearts', 'Spades', 'Clubs', 'Diamonds'] numbers = [2,3,4,5,6,7,8,9,10,'Jack','Queen','King','Ace'] for suit in suits: for number in numbers: self.cards.append(Card(suit, number)) def shuffle(self): random.shuffle(self.cards) def deal(self): c...
null
In JavaScript, what is the difference between var and let?
The main difference between the "var" and "let" keywords in JavaScript is their scope. Variables declared with the "var" keyword have a function scope and are available throughout the entire function, while variables declared with "let" have a block scope and are available only in the block in which they are declared.
null
Create a program in Python to print out the most frequent word in a given dictionary
d = {'dog':3, 'cat':5, 'bird':4, 'horse':7}
# Initialize a variable for the maximum count max_count = 0 # Initialize a variable for the most frequent word most_frequent_word = "" # Loop the dictionary for key, value in d.items(): if value > max_count: max_count = value most_frequent_word = key # Print the most frequent word print("The most...
null
Make the following changes to a JavaScript program.
let num1 = 10; let num2 = 8;
let num1 = 10; let num2 = 8; let sum = num1 + num2; console.log(sum); // Output will be 18.
null
In C++, write a code snippet to print "Welcome to GeeksforGeeks" 10 times using a for loop.
for (int i = 0; i < 10; i++) { cout << "Welcome to GeeksforGeeks" << endl; }
[DE Wikipedia] Ulrike Röttger Ulrike Röttger (* 1966 in Kamen) ist eine deutsche Kommunikationswissenschaftlerin. Seit 2003 ist sie Professorin für Public Relations am Institut für Kommunikationswissenschaft der Westfälischen Wilhelms-Universität in Münster. Im Mai 2008 wurde sie zur Vorsitzenden der Deutschen Gesells...
null
null
null
null
Create a code that recognizes if an inputted string is a palindrome or not.
def is_palindrome(input_string): rev_input = input_string[::-1] return input_string == rev_input
null
What is the command for executing a code written in Java?
The command for executing a code written in Java is "java [filename]".
null
Write a Python program to create an array containing 10 random numbers from 1 to 10 and sort them in ascending order.
import numpy as np # Create an array of 10 random numbers between 1 to 10 arr = np.random.randint(low=1, high=11, size=10) # Sort the array in ascending order arr.sort() print(arr)
null
Define a function in Python that takes two strings and returns a new string which is the concatenation of the two.
"Hello" and "World"
def concatenate_two_strings(str_1, str_2): return str_1 + str_2 conc_str = concatenate_two_strings("Hello", " World") print(conc_str)
[DE Wikipedia] Karl Hoppe Karl Hoppe ist der Name folgender Personen: * Karl Hoppe (Philologe) (1868–1946), deutscher Klassischer Philologe Karl Hoppe (Germanist) (1892–1973), deutscher Germanist Karl Hoppe (Politiker, 1898) (1898–1963), deutscher Politiker (SPD, KP), MdL Saarland Karl Hoppe (Rennfahrer) (1923–1987), ...
null
null
null
[HI Wikipedia] ग्रिम की परी कथाएँ बच्चों की और घरेलू कथाएँ () जर्मन लोक कथाओं का एक संग्रह है जो ग्रिम भाइयों - जैकब और विल्हेल्म के द्वारा १८१२ में प्रकाशित किया गया था। आज इस संग्रह को ग्रिम की परी कथाएँ के नाम से जाना जाता है ()। रचना इन कथाओं के कुल सात संपादन प्रकाशित हुए - पहला संपादन पहला संस्करण -१८१२ - ८६ कथा...
null
null
null
null
Use JS to create an object called `user` which contains two properties: `name` with a string value of "John", and `age` with a numeric value of 25.
let user = { name: "John", age: 25 };
null
Write a Python program to traverse a given array from the end and replace each odd number with the product of the previous and next neighbors.
[1, 3, 5, 7, 9, 11, 13]
def neighbor_product(arr): # loop through array elements in reverse order for i in range(len(arr)-1, 0, -1): # check if element is odd if arr[i] % 2 == 1: # replace element with product of the previous and next neighbors arr[i] = arr[i-1] * arr[i+1] return arr arr = ...
null
Print out the prime numbers between 0 to 100.
for n in range(2, 101): for i in range(2, n): if n % i == 0: break else: print(n, end = ' ')
null
Design an algorithm to find the maximum subarray of an array of numbers.
def max_subarray(arr): max_so_far = 0 max_ending_here = 0 for i in range(len(arr)): max_ending_here = max_ending_here + arr[i] if max_ending_here < 0: max_ending_here = 0 if (max_so_far < max_ending_here): max_so_far = max_ending_here return max_so_far
[DE Wikipedia] Nur dem Namen nach Nur dem Namen nach (OT: In Name Only) ist ein US-amerikanischer Spielfilm mit Carole Lombard, Cary Grant und Kay Francis in den Hauptrollen unter der Regie von John Cromwell. Handlung Alec Walker ist unglücklich mit Maida, einer durch und durch berechnenden Frau, verheiratet. Sie hat ...
null
null
null
null
Using the provided HTML structure and jQuery code, change the background color to green when the button is clicked.
<div> <h1>Hello World!</h1> <button>Click me!</button> </div> <script> $(document).ready(function(){ $("button").click(function(){ //TODO: Add code here }); }); </script>
<div> <h1>Hello World!</h1> <button>Click me!</button> </div> <script> $(document).ready(function(){ $("button").click(function(){ $("div").css("background-color", "green"); }); }); </script>
null
Create a Node.js function to validate an email with a given regex.
function validateEmail(email) { var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; return re.test(email); }
null
Create a python class that generates a multiplication quiz.
class MultiplicationQuiz: def __init__(self, num_questions): self.num_questions = num_questions def generate_quiz(self): # Generate num_questions random questions for _ in range(self.num_questions): num1 = random.randint(1, 12) num2 = random.randint(1, 12) ...
null
Design an algorithm using Python to select the kth largest element from a list.
[5, 10, 15, 20, 25]
def getKthLargest(arr, k): arr.sort() # Return the k'th largest element return arr[len(arr)-k]
null
Design a process in Python for extracting information from a given database.
import sqlite3 # Connecting to the Database file conn = sqlite3.connect('<database name>') # Creating a cursor to work with database cursor = conn.cursor() # Executing a query result = cursor.execute("SELECT <column name> FROM <table name> WHERE <condition>") # Storing the results in a list while iterating over it ...
null
Find all words that contain the string "ed" in the provided text.
She's a very dedicated person, who always tries to get the job done.
dedicated, tried
null
Describe the working of a recursive function.
A recursive function is a function that calls itself until a certain condition is met. It takes in an argument and performs some operation, then calls itself with a modified version of the argument until the condition is satisfied. The result of each call is combined in some fashion to form the final output. This allow...
null
Write a CSS code to make a dive tag red with a background color of yellow.
div { background-color: yellow; color: red; }
null
In Python, write code to sort a list of integers in ascending order.
[9, 15, 5, 11, 4]
def sort_list(list_of_numbers): list_of_numbers.sort() return list_of_numbers print(sort_list([9, 15, 5, 11, 4])) # Output: [4, 5, 9, 11, 15]
null
Write a JavaScript code snippet to track the mouse movement.
document.addEventListener("mousemove", function(e) { console.log("mouse is at x:" + e.clientX + " y:" + e.clientY); });
[CS Wikipedia] Vodní bilance Vodní bilance je poměr mezi příjmem a výdejem tekutin. Denní příjem a ztráta tekutin by měly být v rovnováze. Voda tvoří 50 – 75 % celkové tělesné hmotnosti. Rozdíly jsou dány především podílem tuku v těle. Netuková tělesná hmota obsahuje konstantní množství vody (75 %), zatímco v tukové t...
null
null
null
null
Create a Python function that takes in a list of numbers, evaluates every 3rd number in the list and returns the total.
[3, 8, 7, 4, 9, 2, 1, 6]
def evaluate_list(nums_list): # set counter to 0 counter = 0 # set total as 0 total = 0 # iterate through list for num in nums_list: # check if counter divides by 3 if counter%3 == 0: # add number to total total += num # increment counter ...
null
Add a function to the following JavaScript code to search a value in a given array
const arr = [12, 5, 8, 130, 44];
const arr = [12, 5, 8, 130, 44]; function searchValue(arr, value) { for (let i = 0; i < arr.length; i++) { if (arr[i] === value) { return (i); } } return -1; }
[EN Wikipedia] 2010 Giravanz Kitakyushu season 2010 Giravanz Kitakyushu season Competitions Player statistics Other pages J. League official site Giravanz Kitakyushu Giravanz Kitakyushu seasons
null
null
null