text stringlengths 141 2.89k ⌀ | instruction stringlengths 19 1.5k ⌀ | input stringlengths 0 800 ⌀ | output stringlengths 1 2.5k ⌀ |
|---|---|---|---|
[HI Wikipedia] सुल्तानगंज
सुल्तानगंज (अंग्रेजी: Sultanganj) भारत के बिहार राज्य के भागलपुर जिला में स्थित एक ऐतिहासिक स्थल है। यह गंगानदी के तट पर बसा हुआ है। यहाँ बाबा अजगबीनाथ का विश्वप्रसिद्ध प्राचीन मन्दिर है। उत्तरवाहिनी गंगा होने के कारण सावन के महीने में लाखों काँवरिये देश के विभिन्न भागों से गंगाजल लेने के लिए... | null | null | null |
null | Design a Python program to read in a list of list of strings, eliminate duplicate entries, sort them and print out the result. | [['b', 'a', 'd'], ['c', 'a', 'd'], ['a', 'f', 'g']] | def removeduplicates(list_of_string):
result = []
for item in list_of_string:
if item not in result:
result.append(item)
result.sort()
return result
list_of_string = [['b', 'a', 'd'], ['c', 'a', 'd'], ['a', 'f', 'g']]
print(removeduplicates(list_of_string)) |
null | Define a function to remove all the even numbers from a list in Python. | sample_list = [1,2,3,4,5,6,7,8] | sample_list = [1,2,3,4,5,6,7,8] def remove_even_numbers(lst): for num in lst: if num % 2 == 0: lst.remove(num) return lst print(remove_even_numbers(sample_list)) |
null | Construct a decision tree in Python, based on the given input data. | Input = [Gender ('M' or 'F'), Age, Income, Vehicle]
Target = Loan Approval/Rejection (1 or 0)
[
['M', 24, 33800, 'Petrol'],
['F', 35, 35000, 'Electric'],
['F', 40, 45000 , 'Petrol'],
['M', 20, 25000, 'Electric'],
['M', 30, 32000, 'Petrol'],
[F', 50, 60000, 'Electric'],
] | from sklearn import tree
# Prepare Input
Input = [['M', 24, 33800, 'Petrol'],
['F', 35, 35000, 'Electric'],
['F', 40, 45000 , 'Petrol'],
['M', 20, 25000, 'Electric'],
['M', 30, 32000, 'Petrol'],
['F', 50, 60000, 'Electric']]
# Prepare Target
Target = [1, 0, 1, 0, 0, 1]
... |
[DE Wikipedia] CFE738
Das CFE738 ist ein Zweiwellen-Turbofan-Triebwerk, das für Geschäftsreiseflugzeuge entwickelt wurde und in der Dassault Falcon 2000 eingesetzt wird. Hersteller dieses Triebwerkes ist die CFE Company, ein Joint-Venture von General Electric und Garrett/AlliedSignal (später Honeywell). Weil es von Ge... | null | null | null |
null | Determine how many characters are in a given string. | my_string = "Hello, world!" | length = len(my_string) print(length) # 13 |
[HI Wikipedia] साइक्स-पिकाट समझौता
साइक्स-पिकाट समझौता, जो आधिकारिक तौर पर एशिया माइनर समझौते के रूप में जाना जाता है। ब्रिटेन और फ्रांस की सरकारों के बीच एक गुप्त समझौता था, जिसे रूस की स्वीकृति भी थी। यह समझौता पश्चिमी एशिया में ट्रिपल अंतेंत के अपने प्रस्तावित नियंत्रण और प्रभाव क्षेत्रों को परिभाषित करने के लिए था... | null | null | null |
[DE Wikipedia] John Barton Payne
John Barton Payne (* 26. Januar 1855 in Pruntytown, Taylor County, (Virginia); † 24. Januar 1935 in Washington, D.C.) war ein US-amerikanischer Rechtsanwalt und von 1920 bis 1921 Innenminister der Vereinigten Staaten im Kabinett von US-Präsident Woodrow Wilson. Von 1922 bis 1935 fungie... | null | null | null |
null | Create a web scraper in Python that extracts information from a webpage and stores it in a JSON object. | Not applicable | import requests
from bs4 import BeautifulSoup
import json
url = 'http://example.com/'
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html.parser')
# Get the information
information = {}
information['title'] = soup.title.string
information['h1'] = soup.h1.string
information['description'] = soup.fin... |
null | Create a Python script that scrapes a website for all the external links present in the page. | Not applicable | import requests
from bs4 import BeautifulSoup
def extract_links_from_url(url):
# make a request to the URL
r = requests.get(url)
# create a beautiful soup object
soup = BeautifulSoup(r.content,'html5lib')
# find and return hyperlinks(a tags)
return [link['href'] for link i... |
null | Write a Python script to concatenate two strings. | def concatenate(word1, word2):
return word1 + word2 | |
null | Develop a functional web spider in Python that can crawl the web and collect articles from a given topic related to technology. | Not applicable | import requests
from bs4 import BeautifulSoup
def web_spider(max_pages):
page = 1
while page <= max_pages:
# Make request to target page
source_code = requests.get('http://example.com/tech/page' + str(page))
plain_text = source_code.text
soup = BeautifulSoup(plain_text, 'html.parser')
# Get data from html page
... |
null | Write a Python program to generate a random number between 1 and 10. | import random
random_num = random.randint(1, 10)
print(random_num) | |
null | Using PHP, how can you print the JavaScript code that displays an alert message with the text “Hello World”? | echo "<script>alert('Hello World');</script>"; | |
null | What are the main components of an object oriented programming language? | The main components of an object oriented programming language are classes, objects, methods, and inheritance. Classes are the blueprint used to create objects, methods are the functions which act on objects, and inheritance is the ability for classes to define a common set of characteristics. | |
null | Write a python program to encrypt a string using the Caesar cipher. | plain_text = 'Lorem ipsum dolor sit amet' | def caesar_encrypt(plain_text, shift):
cipher = ''
for char in plain_text:
if char == ' ':
cipher = cipher + char
elif char.isupper():
cipher = cipher + chr((ord(char) + shift - 65) % 26 + 65)
else:
cipher = cipher + chr((ord(char) + shift -... |
[HI Wikipedia] अहमदाबाद
अहमदाबाद (Ahmedabad) या अमदावाद (Amdavad) भारत के गुजरात राज्य का सबसे बड़ा नगर है। यह अहमदाबाद ज़िले का मुख्यालय भी है। भारतवर्ष में यह नगर का सातवें स्थान पर है। इक्क्यावन लाख की जनसंख्या वाला ये शहर, साबरमती नदी के किनारे बसा हुआ है। १९७० में गांधीनगर में राजधानी स्थानांतरित होने से पहले अहम... | null | null | null |
[DE Wikipedia] Sragen (Regierungsbezirk)
Sragen ist ein indonesischer Regierungsbezirk (Kabupaten) in der Provinz Jawa Tengah, im Zentrum der Insel Java. Mitte 2022 leben hier etwa mehr als eine Million Menschen. Hauptstadt und Regierungssitz des Verwaltungsbezirks ist die Stadt Sragen, etwa 75 km südöstlich der Provi... | null | null | null |
[EN Wikipedia] Te Arai River
The Te Arai River is a river of the Gisborne Region of New Zealand's North Island. It flows generally north from its origins in rough hill country north of Nūhaka before veering northeast past the township of Manutuke to reach the Waipaoa River five kilometres from the latter's outflow int... | null | null | null |
null | Write a JavaScript expression to check whether the string "Hello World" is present in another string. | var test_str = "Hello World is a popular phrase"; | test_str.includes("Hello World"); |
[HI Wikipedia] लोक जनशक्ति पार्टी
लोक जनशक्ति पार्टी (:लोजपा), एक राज्य स्तरीय मान्यता प्राप्त राजनैतिक दल है, जो मुख्य रूप से भारत के बिहार राज्य की राजनीति में सक्रिय थी। पार्टी का गठन 2000 में हुआ जब रामविलास पासवान जनता दल से अलग हो गए। बिहार में दलितों के बीच पार्टी की अच्छी-खासी पकड़ थी। 2021 में पार्टी दो पार्ट... | null | null | null |
null | Output a code to edit the following HTML to add a new heading 'Introduction' before the existing heading 'About'. | <h1>About</h1> | <h1>Introduction</h1> <h1>About</h1> |
null | Use classes and objects to create an employee class with attributes such as name, age, salary, and role. | class Employee: def __init__(self, name, age, salary, role): self.name = name self.age = age self.salary = salary self.role = role # Create an employee employee = Employee("John Doe", 34, 10000, "Software Engineer") | |
null | Develop an algorithm in Python that takes a number as input and outputs the sum of all its divisors. | 6 | def sum_divisors(num):
# Initialize sum
summation = 0
# Iterate upto num
for i in range(1, num+1):
# If num is divisible
# by i, add it to sum
if num%i == 0:
summation += i
# Return summation
return summation
# Driver Code
num = 6
result = s... |
null | You need to rearrange the characters in a given string such that no two same characters are adjacent to each other. | abccab | def rearrange(string): seen = set() result = [] for char in string: if char not in seen: seen.add(char) result.append(char) else: for ch in string: if ch not in seen: seen.add(ch) result.append(ch) return ''.join(result) |
null | Create an algorithm in Python for the classification of numbers into even or odd. | 3 | def classifyNumber(num):
if num % 2 == 0:
return "even"
else:
return "odd"
print(classifyNumber(3)) |
null | Create a table in SQL to store the names and email addresses of users. | CREATE TABLE users ( name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL ); | |
[CS Wikipedia] Šavnik
Šavnik () je město v severní části Černé Hory. Bylo založeno roku 1861. Je neoficiální střediskem regionu Drobnjaci pojmenovaného podle stejnojmenného srbského klanu. Je centrem stejnojmenné opštiny s 2 947 obyvateli rozkládající se na 553 km². Samotné město má 570 obyvatel (údaj z roku 2003). Op... | null | null | null |
[EN Wikipedia] Alfons Maria Jakob
Alfons Maria Jakob (2 July 1884 – 17 October 1931) was a German neurologist who worked in the field of neuropathology. He was born in Aschaffenburg, Bavaria and educated in medicine at the universities of Munich, Berlin, and Strasbourg, where he received his doctorate in 1908. During ... | null | null | null |
null | Develop a web scraper in Python that visits a website and retrieves the contents of the web page. | The URL of the website: https://www.example.com | import requests
url = "https://www.example.com"
response = requests.get(url)
if response.status_code == 200:
html = response.content
print(html) |
null | Construct a Python script that deletes all the characters in a given string except for the vowels. | "Hello World!" | # Get the input string
string = "Hello World!"
# Modify the string
vowels = "aeiou"
new_string = ""
for char in string:
if char in vowels:
new_string += char
# Print the string
print(new_string)
# prints "eoo" |
null | Create a Python program to fetch customer records from a database. | import mysql.connector
conn = mysql.connector.connect(
host="localhost",
user="root",
passwd="",
database="yourdatabase"
)
cursor = conn.cursor()
query = "SELECT * FROM customers"
cursor.execute(query)
rows = cursor.fetchall()
for row in rows:
customer_id, customer_name, customer_address = row
print(f"ID: {cust... | |
[CS Wikipedia] Návrat domů
Slovní spojení Návrat domů má více konkrétních významů: Návrat domů (nakladatelství), evangelicky zaměřené nakladatelství v Praze Návrat domů je v češtině také titul řady literárních (viz ), případně jiných uměleckých děl. Skladba Jiřího Sternwalda: Návrat domů pro sbor a symfonický orchestr... | null | null | null |
null | Create a Python script that uses a for loop to display the items from a list. | [apple, orange, banana] | # Create a list
list = ['apple', 'orange', 'banana']
# Loop over the list
for item in list:
print(item) |
null | You need to code a program that converts a given number of days to years, month and days. | 450 days | def convertToYMD(num_days): years = int(num_days/365) rem_days = num_days % 365 months = int(rem_days / 30) days = rem_days % 30 return [years, months, days] |
[EN Wikipedia] Nuritamburia metallurgica
Nuritamburia metallurgica is a moth of the family Tortricidae. It was first described by Lord Walsingham in 1907. It is endemic to the Hawaiian islands of Oahu, Molokai, Lanai and Hawaii. The larvae possibly feed on Phyllanthus and Xylosma species. External links Archipini Ende... | null | null | null |
null | Write a Python program to populate a database from a given dataset of products. This program should loop through each record of the dataset and check if the product has already been persisted, and if not, it should save the record to the database. | products_dataset: List[Dict[str, str]] = [
{'name': 'baseball bat', 'price': 19.99, 'quantity': 20},
{'name': 'soccer ball', 'price': 9.99, 'quantity': 10},
{'name': 'football', 'price': 14.99, 'quantity': 5},
] | import sqlite3
db = sqlite3.connect('products.db')
cursor = db.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS products (name text, price real, quantity integer)")
for product in products_dataset:
product_name = product['name']
product_price = product['price']
product_quantity = product['quantity']
... |
[DE Wikipedia] OHL 2000/01
Die OHL-Saison 2000/01 war die 21. Spielzeit der Ontario Hockey League. Die reguläre Saison begann am 21. September 2000 und endete am 23. März 2001. Die Play-offs starteten am 24. März 2001 und endeten mit dem dritten J.-Ross-Robertson-Cup-Gewinn der Ottawa 67’s am 15. Mai 2001, die sich im... | null | null | null |
null | Create a class in Python using object-oriented programming that creates instance of a book. | class Book(object):
def __init__(self, title, author, year_published):
self.title = title
self.author = author
self.year_published = year_published
def __str__(self):
return '{0} by {1} published in {2}.'.format(
self.title, self.author, self.year_published) | |
null | Given an array of strings, write a JavaScript function to filter out all elements that are not palindromes. | ["a", " racecar", " abba ", "civic", " pot op "] | function filterPalindromes(arr) { return arr.filter(element => { let strippedString = element.replace(/\s+/g, ""); let reversedString = strippedString.split('').reverse().join(''); return strippedString == reversedString; }); } console.log(filterPalindromes(["a", " racecar", " abba ", "civic", " pot op "])); // Output:... |
null | Compute the sum of the prime numbers from 0 to n using Java. | n = 10 | public class PrimeSum{ public static int sumOfPrime(int n){ int sum = 0; for(int i=2; i<=n; i++){ if(isPrime(i)) sum += i; } return sum; } private static boolean isPrime(int n){ for(int i=2; i<n; i++){ if(n%i == 0) return false; } return true; } } |
null | Create a function that takes a string of brackets and checks if they are correctly matched or not. | def check_brackets(bracket_string): """ Function that checks if bracket string is correctly matched. """ stack = [] open_brackets = {'[', '{', '('} close_brackets = {']', '}', ')'} for bracket in bracket_string: if bracket in open_brackets: stack.append(bracket) elif bracket in close_brackets: if not stack or close_bra... | |
null | Under the given dictionary, write a code to replace the value at a given key. | dictionary = { 'name': 'David', 'age': 20 } key = 'name' value = 'Eddie' | dictionary[key] = value |
null | Given two linked lists, write a Java program to merge them. | The two linked lists are: List1 (1 -> 4 -> 5 -> 8 -> 10) List2 (2 -> 3 -> 6 -> 7 -> 9) | public static ListNode mergeLinkedLists(ListNode head1, ListNode head2) { if(head1 == null) return head2; if(head2 == null) return head1; ListNode mergedList; if(head1.val < head2.val) { mergedList = head1; mergedList.next = mergeLinkedLists(head1.next, head2); } else { mergedList = head2; mergedList.next = mergeLinked... |
null | Make a program that takes in a non-empty string and finds its longest palindrome. | def longest_palindrome(text): longest_palindrome = "" for i in range(len(text)): for j in range(len(text), i, -1): substring = text[i:j] if substring == substring[::-1] and len(substring) > len(longest_palindrome): longest_palindrome = substring return longest_palindrome | |
null | This code defines a class called "Attr" that represents an attribute of an HTML element. To use it, create an instance of the class and pass in the document, parent element, and attribute name as arguments. The attribute value can be accessed and modified using the "value" property. Other properties and methods are ava... | #!/usr/bin/env python
import bs4 as BeautifulSoup
from .Node import Node
class Attr(Node):
_value = ""
def __init__(self, doc, parent, attr):
self.doc = doc
self.parent = parent
self.attr = attr
self.tag = BeautifulSoup.Tag(parser = self.doc, name = 'attr')
N... | |
null | Create a program in Python that evaluates a postfix expression. The input to the program should be a string with the postfix expression. The output should be the evaluated value of the expression. | "2 3 + 4 5 * *" | def evaluate(expression):
# split expression into list
expression = expression.split()
# stack to store integer values.
stack = []
# do for every element of expression.
for element in expression:
# If element is an operand push
# into stack it's a number onl... |
null | Using ReactJS, develop a basic form component with two input fields, one for a Name and the other for Age. | class BasicForm extends React.Component { constructor(props) { super(props); this.state = { name: '', age: '', }; } render() { return ( <form> <label>Name: <input type="text" name="name" value={this.state.name} onChange={this.handleChange} /> </label> <label>Age: <input type="text" name="age" value={this.state.age} onC... | |
[EN Wikipedia] List of Israeli films of 1966
A list of films produced by the Israeli film industry in 1966. 1966 releases See also 1966 in Israel References External links Israeli films of 1966 at the Internet Movie Database Israeli Film 1966 | null | null | null |
null | Write a SQL query to select users whose age is greater than or equal to 20 from the user_data table. | SELECT * FROM user_data WHERE age >= 20; | |
null | Create a SQL query to sort a table by its numerical contents. | Table: +-----------+-----------+ | Name | Score | +-----------+-----------+ | John | 90 | | Mary | 80 | | Miguel | 75 | | Fanny | 99 | +-----------+-----------+ | SELECT * FROM table ORDER BY Score; |
null | Generate the syntax for initializing an array of integers with the given elements. | [1, 2, 3] | int[] arr = {1, 2, 3}; |
null | Create a function to find the value of Pi rounded to the 3rd decimal point. | def find_pi(): pi = 3.141 return round(pi, 3) # rounded to the 3rd decimal point | |
null | Write a SQL query to generate a table that contains the number of customers per county | SELECT county, COUNT(*) AS 'Number of Customers' FROM Customers GROUP BY county; | |
null | Generate a unique 6 character alphanumeric string. | j4xdu6. | |
[EN Wikipedia] Kick Back
Kick Back is the third extended play by the Chinese boy band WayV with the lead single of the same name. It was released on March 10, 2021, by Label V and SM Entertainment, with Dreamus as the South Korean distributor and Owhat as the distributor for China. Consisting of six songs that fall mo... | null | null | null |
null | Using JavaScript, print the name of sites visited today on the web console. | var visitedSites = ["www.facebook.com", "www.google.com", "www.yahoo.com"]; console.log("Visited sites today: " +visitedSites); | |
[CS Wikipedia] I'll Tumble 4 Ya
"I'll Tumble 4 Ya" je New Wave/pop-karibská píseň od skupiny Culture Club. Song je z jejich debutního alba Kissing to Be Clever. Píseň byla vydán firmou Virgin, trvá 2:36 minut. Tato píseň zazněla ve filmu "Billy Madison" (1995), kde hrál Adam Sandler. Verze Kanada 7" vinyl A. "I'll Tum... | null | null | null |
null | Create a Python program to retrieve real time data from a web API. | import requests
# Make a get request to get the latest position of the International Space Station
response = requests.get("http://api.open-notify.org/iss-now.json")
# Print the status code of the response
print(response.status_code) | |
null | Explain what API stands for and what it does. | API stands for Application Programming Interface, which is a set of routines, protocols, and tools used to build software applications. It defines how two applications can interact with each other and allows for data to be exchanged between them. APIs provide developers with predefined sets of code which can be used to... | |
null | Turn the following sentence into an imperative sentence. | Let's print "Hello World" | Print "Hello World". |
null | Develop a Python program that counts the number of vowels in a string. | def count_vowels(s):
count = 0
vowels = "aeiou"
for char in s:
if char in vowels:
count += 1
return count | |
null | Translate the following JavaScript code into Python. | let x = 10; if(x > 0){ console.log("x is positive"); } | x = 10 if x > 0: print("x is positive") |
null | Generate a python program to print the first n elements of a given list. | def print_n_elements(n, list):
for i in range(n):
print(list[i]) | |
[DE Wikipedia] Ingvar Sandström
John Ingvar Sandström (* 3. September 1942 in Lycksele) ist ein ehemaliger schwedischer Skilangläufer. Sandström, der für den Lycksele IF startete, errang bei den nordischen Skiweltmeisterschaften 1966 in Oslo den zehnten Platz über 15 km und jeweils den vierten Platz über 30 km und mit... | null | null | null |
[CS Wikipedia] Tlak
Tlak je fyzikální veličina, obvykle označovaná symbolem p nebo P (z anglického pressure), vyjadřující poměr velikosti síly F, působící kolmo na rovinnou plochu a rovnoměrně spojitě rozloženou po této ploše, a obsahu této plochy S, tedy . Pokud není tato síla F rozložena na dané ploše rovnoměrně, pa... | null | null | null |
[CS Wikipedia] It's Raining Men
„It's Raining Men“ je disco/dance píseň od kapely The Weather Girls. Píseň pochází z alba Success a trvá 4:06 minut, ale jako 12" singl má kolem 5:24 minut. Skladbu napsali Paul Jabara a Paul Shaffer (frontman CBS Orchestra, kapela v Noční show Davida Lettermana). Skladba se stala gaysk... | null | null | null |
null | Create a function in Python which takes an integer n and an unsorted list of numbers as input and returns the nth smallest number in the list. | [5, 8, 1, 9, 4], 3 | def nth_smallest(nums, n): sorted_nums = sorted(nums) return sorted_nums[n-1] print(nth_smallest([5, 8, 1, 9, 4], 3)) # Output: 5 |
null | Create a stack and add two elements to it. | class Stack(): def __init__(self): self.items = [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() stack = Stack() stack.push(5) stack.push(7) | |
null | Write a CSS selector to select all the list items with class "list-item". | li.list-item { } | |
null | Implement a random number generator in Python that returns a random number in the range of 1-100. | import random def rand_num(): return random.randint(1, 100) | |
null | Write an SQL Query to print a list of all employees who have a higher salary than their managers. | SELECT e1.name AS Employee, e2.name AS Manager, e1.salary AS Employee_Salary, e2.salary AS Manager_Salary FROM employee e1 JOIN employee e2 ON e1.managerid = e2.employeeid WHERE e1.salary > e2.salary; | |
[EN Wikipedia] Agaricicola
Agaricicola is a genus in the phylum Pseudomonadota (Bacteria). Etymology The name Agaricicola derives from:Neo-Latin noun Agaricus, generic name of a mushroom; Latin suff. -cola (from Latin masculine gender or feminine gender noun incola), dweller; Neo-Latin masculine gender noun Agaricicol... | null | null | null |
null | Create a set containing the numbers from 1-10 that are divisible by 3. | my_set = {3, 6, 9} | |
null | Build a binary search algorithm in Python that takes in an input list and a target value to search for. | def binary_search(arr,target):
low = 0
high = len(arr) - 1
while low <= high:
mid = (low + high) // 2
if arr[mid] == target:
return mid
elif arr[mid] < target:
low = mid + 1
else:
high = mid - 1
return -1
arr = [2, 3, 4, 10, 40]
target = 10
index = binary_search(arr, target... | |
[CS Wikipedia] Sonequa Martinová-Greenová
Sonequa Martinová-Greenová (* 21. března 1985 Russellville, Alabama) je americká herečka. Vystudovala divadelnictví na University of Alabama. Od roku 2005 postupně hrála v několika nezávislých filmech, v roce 2011 se představila ve snímku Yelling to the Sky. Od roku 2008 hosto... | null | null | null |
null | Create a Python program that produces the output shown in this example. | 3
3
3
3
3
3 | def print_grid(grid_size):
for x in range(grid_size):
for y in range(grid_size):
print(grid_size, end=" ")
print()
grid_size = 3
print_grid(grid_size) |
[EN Wikipedia] Naoki Murata
was an 8th dan Japanese judoka and author. He has written many books about judo. He was also the curator of the Kodokan Judo Museum in Tokyo. Biography Murata was born in Tokorozawa, Saitama in 1949. He studied at the Faculty of Physical Education, Department of Martial Arts of the Tokyo Un... | null | null | null |
null | Write a Python program to select a random element from a given list. | import random
def random_element(lst):
return random.choice(lst) | |
null | Generate a program to output the most frequently used words in a given string | txt = "Python is a powerful language that is used for a wide range of applications" | from collections import Counter
def most_frequent(string):
data = string.split(" ")
data1 = Counter(data)
return data1.most_common(1)[0]
txt = "Python is a powerful language that is used for a wide range of applications"
assert most_frequent(txt) == ('is', 2)
print("Most frequent word is : ", most_frequent(... |
null | Generate a Python program to find the longest increasing subsequence in a given list of numbers | def find_longest_increasing_subsequence(array):
n = len(array)
Length = [1] * n
SequenceArray = [None] * n
for index1 in range(n):
for index2 in range(index1):
if array[index2] < array[index1] and Length[index2] >= Length[index1]:
Length[index1] = Length[index2] + 1
... | |
null | Write a Python function to get the n-th number in the Fibonacci sequence. | def fibonacci(n):
a = 0
b = 1
if n < 0:
print("Incorrect input")
elif n == 0:
return a
elif n == 1:
return b
else:
for i in range(2,n):
c = a + b
a = b
b = c
return b | |
null | Take input of a Python list and return its reversed version | list_in = [3,5,7,9] | list_in.reverse() list_out = list_in print(list_out) # Output # [9,7,5,3] |
null | Develop a Python function to determine the maximum possible sum of two numbers even after swapping. | """
def max_sum_swap(a, b):
x = max(a, b)
y = min(a, b)
# swap the numbers
x = x + y
y = x - y
x = x - y
return x + y
""" | |
null | Generate a regex for email validation | ^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$ | |
null | What are the benefits of abstract classes in Java? | Abstract classes in Java provide a way to define and enforce common behavior that is shared between derived classes. They also allow for code reuse as the shared code can be reused by other classes. Furthermore, with the help of abstract classes, one can create a structure for developers to follow and provide a standar... | |
null | How do you represent a database table and its columns in an object-oriented programming language? | Classes are typically used to represent a database table in an object-oriented programming language. Each of the database table's columns can be represented as fields in the class. The values for those fields can then be accessed though the class' accessor methods. | |
[EN Wikipedia] Renny Lister
Renny Lister (born 24 May 1934) is a British retired film and television actress. Personal life Lister was born on 24 May 1934 in Manchester. She married Eric Lister in 1953, the marriage later ended in divorce although she retained her first husband's name as her stage name. Lister married... | null | null | null |
null | Develop an efficient sorting technique in Python to arrange the following list of strings. | L1= ["This", "is", "a", "list", "of", "strings"] | def sort_list(L1):
L1.sort()
return L1 |
null | Create a basic React component. | import React from 'react'; const MyComponent = () => { return ( <div> <p>Hello, world!</p> </div> ); }; export default MyComponent; | |
null | What function will you use to count the number of words in a string? | 'Hello world, this is a sentence.' | There are 5 words in the given string.
To count the number of words in a string, you can use the `len()` or `count()` functions in Python.
For example:
```
num_words = len(string.split())
```
or
```
num_words = string.count(" ") + 1
``` |
null | Calculate the factorial of a positive integer in C. | #include <stdio.h> int factorial(int n) { int i, fact = 1; // handles cases greater than 1 if (n > 1) { for (i = 2; i <= n; i++) fact = fact * i; } return fact; } int main() { printf("The factorial of 5 is %d", factorial(5)); return 0; } | |
null | Output the result of 3+5*2-9 | 3 + 5 * 2 - 9 = 2 | |
[CS Wikipedia] Village People
Village People je americká konceptuální disco formace, která vznikla v roce 1977. Skupina je známá svými podiovými kostýmy, které jsou vyobrazením amerických pracovních a společenských vrstev i chytlavou hudební produkcí. Skupinu vytvořil francouzský skladatel Jacques Morali; společně s p... | null | null | null |
null | Define a Python class called Appointment that creates appointment objects. | class Appointment():
def __init__(self, date, time, reason):
self.date = date
self.time = time
self.reason = reason
def get_details(self):
return f" The appointment is on {self.date}, at {self.time}, for {self.reason}." | |
[HI Wikipedia] मार्च २३ अभियान
मार्च २३ अभियान (), जिसे ऍम२३ (M23) और कांगोई क्रान्तिकारी सेना (Congolese Revolutionary Army) के नाम से भी जाना जाता है, अफ़्रीका के कांगो लोकतान्त्रिक गणराज्य के पूर्वी भागों में सक्रीय एक विद्रोही सैनिक संगठन है। यह विशेषकर उत्तर कीवू प्रान्त में गतिविधियाँ करता है। वर्तमान में यह कां... | null | null | null |
null | Create a JavaScript object that stores three pieces of digital contact data, an email address, a phone number, and a website URL. | const contact = { email: 'example@example.com', phone: '000-000-0000', website: 'www.example.com' }; | |
null | Write a Python function to find all pairs in a given list of numbers whose sum equals a given target number | Given List: [1, 4, 2, 9, 5] Target number: 7 | def find_pairs_sum(numbers, target): res = [] for i in range(len(numbers)): for j in range(i + 1, len(numbers)): if numbers[i] + numbers[j] == target: res.append([numbers[i], numbers[j]]) return res |
[HI Wikipedia] हरेश बुधरानी
हरेश किशिनचंद बुधरानी (), क्वींस काउंसेल, भारतीय मूल के जिब्राल्टेरियन बैरिस्टर हैं। इन्होंने अपनी शिक्षा इंग्लैंड के शैक्षणिक संस्थानो से प्राप्त करी थी तथा अगस्त 1975 में बैरिस्टर बन गए। यह 2004 तक हिन्दू मर्चेंट्स एसोसिएशन ऑफ़ जिब्राल्टर के अध्यक्ष रहे थे। यह जिब्राल्टर संसद में सितम्बर ... | null | null | null |
null | Create a HTML code to make a hyperlink of "https://www.example.com" that shows the text "Click Here". | <a href="https://www.example.com">Click Here</a> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.