instruction_seed stringlengths 29 40.5k | source stringclasses 6
values |
|---|---|
Please write a program that classifies each word in a given list as a noun, verb, or adjective based on the following criteria:
1. If a word starts with a capital letter and ends with "ing", classify it as a verb.
2. If a word starts with a lowercase letter and ends with "ing", classify it as an adjective.
3. If a wor... | codefeedback |
Implement a Python library that can compute skewness of a given dataset. The library should account for outliers and missing data points. Additionally, include functionality to adjust skewness to approximate Normal Distribution under possible circumstances. Also create a detailed documentation explaining each method of... | codefeedback |
Determine the largest number and its position in a list of integers using C. Also, create a function to handle any possible errors or exceptions such as if the input is not an integer, if the list is empty, or if the list contains non-numeric characters. The code should be well documented for readability and future ref... | codefeedback |
Find the maximum number of left and right parentheses that can be balanced for a given expression, where the expression may also contain curly braces {} and square brackets [] in addition to parentheses ().
Expression: [{(())}]{} | codefeedback |
Generate the Fibonacci sequence of length 20 and print the result, starting from the 5th element. | codefeedback |
Generate a Java program to get the maximum number from a given array. The program should also return the index of the maximum number. Additionally, the program should handle arrays of any size and should have a time complexity of O(n) or better. | codefeedback |
Write a code to find elements in an array that are divisible by a given number and are also greater than 10. The code should return the sum of all the divisible elements. The array should have a minimum length of 10. The code should also check if the given number is prime and only consider elements in the array that ar... | codefeedback |
Create a function to scale a number by the given factor using a specific non-linear scaling method. The scaling method should be the sigmoid function, defined as f(x) = 1 / (1 + e^(-x)).
factor = 0.5 | codefeedback |
You are tasked with creating a program that analyzes the frequency of words in a given text. Your program should take a string of text as input and output the frequency of each word in the text. For the purpose of this problem, a word is defined as a sequence of characters separated by spaces. Punctuation marks should ... | codefeedback |
Construct a query to find all records in the table with a particular value. Table Name: employees, Column Name: name, Value: John
- Step 1: Start by writing the SQL query to select all records from the employees table.
- Step 2: Add a WHERE clause to filter the records based on the value of the name column. Use the eq... | codefeedback |
Write a SQL query to display the name and country of the customers who have purchased products in the last 24 hours. | codefeedback |
this python code is from an ocr scan and it won't compile. can you help?
trom nnath lmpor+ sqn+
def 90lygon anea(vertices):
n = |en{vent1ces)
H Checx for cOnvexity
for i in nange(n):
x1, y1 = vertice5[i]
x2, yz = vertices[(i+1)%n]
x3` v3 - ver7i<es[(i+2)%n]
cn0s5_9nodu(t =_(x2 - x1)*(y3 - v1) = (y2_- y1)*(x3 -_x1)
... | codefeedback |
You are tasked with creating a program that simulates a simplified file operation system. The program should implement a function to delete a file using the Windows Shell API and handle potential errors that may occur during the deletion process.
Your task is to implement a function `deleteFile` that takes a file path... | codefeedback |
You are tasked with implementing a text formatting algorithm that wraps long words to fit within a specified line length. The algorithm should break long words at appropriate points and insert line breaks to ensure that no word exceeds the line length. The provided code snippet is a part of the algorithm that handles t... | codefeedback |
Given a list of integers, you need to delete all prime numbers from the list. Write a function that takes in the list of integers and returns the modified list without any prime numbers.
The input list may contain duplicate elements and the function should delete all occurrences of prime numbers from the list.
You sh... | codefeedback |
Use set operations to obtain the intersection of two given sets. The program should also remove any duplicates from the resulting intersection set, sort the elements in descending order, and return the sum of all elements in the intersection set. Additionally, the program should output the number of elements in the int... | codefeedback |
Create a web application that allows users to input a paragraph of text in English and convert it into a non-Latin script randomly chosen from a set of five options (e.g., Chinese, Arabic, Devanagari, Thai, and Hebrew) each time the conversion button is clicked. The converted text should be displayed in a visually appe... | codefeedback |
Create a JSON string from the following Javascript object.
Object:{
"name": "john",
"age": 25,
"address": {
"city": "National City",
"state": "CA"
},
"phoneNumbers": [
{
"type": "home",
"number": "1234567890"
},
{
"type": "work",
"number": "9876543210"
}
],
... | codefeedback |
Write a program that takes two integers as input and calculates the sum of all the even numbers between them (inclusive). Display the result as output. | codefeedback |
You are tasked with implementing a function to calculate the number of leap years between two given years, taking into account the oddities of leap seconds. Leap years are years that are divisible by 4, except for years that are divisible by 100 but not by 400. However, there are some peculiarities when dealing with da... | codefeedback |
Write a Java program to sort an array of objects by their age in ascending order.
[
{“name”: “John”, “age”: 20},
{“name”: “Jane”, “age”: 40},
{“name”: “Mary”, “age”: 30 },
{“name”: “Mike”, “age”: 50 },
] | codefeedback |
Perform feature scaling using StandardScaler on the breast cancer dataset provided by Scikit-learn. Afterward, divide the data set into training and validation sets. For each set, calculate and document the mean and the standard deviation. Then implement a K-Nearest Neighbor classifier on the transformed data, tuning t... | codefeedback |
You are tasked with creating a Java program to simulate a simple GUI-based application for managing a list of tasks. The application should allow users to add, remove, and display tasks using a graphical user interface.
Your task is to implement the `Task` class to represent a single task with a name and a priority le... | codefeedback |
Develop a function employing advanced Python coding techniques like decorators or generator expressions, that not only ascertains the veracity of the supplied data within an educational denomination specifically referred to as "Scholar", but also validate that data against a set of complex predetermined rules such as r... | codefeedback |
You are tasked with implementing a load balancer algorithm for a web server. The load balancer needs to select a subset of URLs from a given list based on a specific version and then distribute the traffic among the selected URLs. The load balancer's selection process is influenced by the version of the URLs and is per... | codefeedback |
Build a code to print out all unique permutations of the characters in a given string without using recursion. The input string can have duplicate characters, and the code should handle these duplicates correctly. Additionally, the code should be able to handle input strings of length up to 10^6 efficiently.
In the or... | codefeedback |
Format the following text using Markdown.
The purpose of this project is to create a user-friendly program for calculating the area of a circle. The program should prompt the user to enter the radius of the circle and then calculate and display the area. The formula to calculate the area of a circle is A = πr^2, where... | codefeedback |
Develop a CSS style that modifies the color attribute of every hyperlink element within a webpage, setting their appearance to an intricate shade of purple. | codefeedback |
You are tasked with creating a Python function that parses a given text file to extract the copyright information. The copyright information is typically found within comments at the beginning of the file and follows a specific format. The function should return the name of the copyright holder and the license under wh... | codefeedback |
Create a method to validate an email address in Java that also checks if the email address is from a specific subdomain (e.g., subdomain.example.com). Additionally, the method should validate the format of the email address according to the RFC 5322 standard and should reject any email addresses that contain special ch... | codefeedback |
Generate a code in R to remove spaces, punctuation, and duplicate characters from a given string, while also converting all characters to lowercase. The given string should contain at least one alphanumeric character. The given string is "Hello, World.".
The code should have a time complexity of O(n) and a space compl... | codefeedback |
You are tasked with creating a Python function that simulates the behavior of a package manager's load command. The load command is responsible for loading a package and its dependencies. The function should take a parser and arguments as input and return the specifications of the package and its dependencies based on ... | codefeedback |
Generate a recursive function for calculating the factorial of a number. | codefeedback |
Design a class definition in Python to construct a Musician object with the attributes age, name, instrument, and genre. Implement a method to calculate musician's experience based on age and create a function to sort a list of Musician objects by genre and then age. | codefeedback |
Explain the term "backtracking" and provide an implementation of a backtracking algorithm in any programming language that finds all possible solutions for a given Sudoku puzzle, considering the constraints that each row, column, and 3x3 subgrid must contain all numbers from 1 to 9 without repetition. | codefeedback |
Create a React application for displaying a table of all customers and their orders from a given database.
Table Structure:
customers: id, name, address
orders: id, customer_id, order_date | codefeedback |
You are tasked with implementing a camera system for a 3D environment. The camera has a position and a rotation, and the view matrix needs to be updated based on certain constraints.
You are given the following code snippet as a starting point:
```cpp
rotation.x = std::clamp(rotation.x, Maths::Radians(90.0f), Maths::... | codefeedback |
Design a Node.js class to create a RESTful API. | codefeedback |
i've got this python code from an ocr tool, but it's not working. can you debug it for me?
def sort_4no_nota+3(ls+, n):
if not_0 c= m < lem{ls7}:
print{f"Indek '{n]'_is 0u7 ot bounds, Ple&5e pnou!de a prop3r !nd€x.")
neturn
+ry:
lst = lst[n:] + lst[:n}
|57.sort(key=|@mbda x:_sum[k) lf !sinst4nce(x, list) el5e k)
return... | codefeedback |
Create an HTML form that takes 5 inputs: name, age, gender, email, and phone. Validate the inputs to ensure that:
1. The name input only accepts alphabetic characters and has a maximum length of 30 characters. Additionally, the name must not contain any special characters, numbers, or spaces.
2. The age input only acce... | codefeedback |
You are tasked with creating a Python function that takes a prompt message as input and prompts the user to input a "yes" or "no" response. The function should handle the possibility of a user interrupting the input process with a keyboard interrupt (Ctrl+C) and return an appropriate value in such cases. The function s... | codefeedback |
Create a machine learning classifier in Python for categorizing user input. | codefeedback |
Embark on an exhaustive expedition to unravel the enigma of quantum superposition, emphasizing its cardinal role in the rapidly advancing field of quantum informatics. Could you construct a multi-faceted narrative that delves into the origin, evolution, and practical application of theoretical principles deeply embedde... | codefeedback |
Create an array of size 10 with each element being a random prime number between 1 and 100. | codefeedback |
Generate a C program that takes a string as input and prints the ASCII values of all characters in the string, separated by commas. The program should also keep track of the total sum of all ASCII values and print it at the end. The input string should have a minimum length of 5 characters. | codefeedback |
Construct a MongoDB database query that retrieves the fifth and sixth documents specifically from a collection when organized in a descending manner. This task requires careful consideration of indexing and sorting techniques. | codefeedback |
Write a JavaScript code to read the content of a given URL, validate its format and store it in a MongoDB database, ensuring that the data is properly indexed and avoiding any duplicate entries. | codefeedback |
Create a shell script that not only prints out the current phase of the moon based on the current date, but that also accurately predicts and prints the next date of a new moon and full moon. The script should be resilient to system time adjustments or if it's executed in a different time zone. | codefeedback |
Given a list of numbers, find and print the difference between the largest and smallest prime numbers in the list. Additionally, the program should sort the list in descending order before finding the difference.
list_of_numbers = [10, 7, 5, 12, 4] | codefeedback |
Write a JavaScript function that takes two strings as arguments. The strings represent large numbers that may not fit into JavaScript's number data types. Your function should add these two "numbers" without any data inconsistency and return the result. Validate the inputs to ensure they only contain digits, and handle... | codefeedback |
You are tasked with implementing a function that extracts the UUID (Universally Unique Identifier) from a System Information (SMBIOS) data structure. The SMBIOS data is stored in a byte array and contains various system information types. The function should locate the System Information type within the byte array and ... | codefeedback |
Devise a Python program that calculates the sum of the factorials of the digits of a specified number. Furthermore, the program should then try to reconstruct the original number by arranging these factorial values in some combination. If it's possible to create the original number using the factorial sum, the program ... | codefeedback |
Construct an R script that sorts a given list of numbers in descending order. Additionally, implement the sorting algorithm from scratch instead of using a built-in function. Your algorithm should have a time complexity of O(nlogn) and should not use any additional data structures. | codefeedback |
Construct a web-oriented interactive framework that facilitates the conveyance of graphical information, subsequently leveraging the sophisticated capabilities of Amazon Rekognition for an exhaustive analysis and extraction of labeled components embedded within the uploaded visuals. This procedure necessitates a layere... | codefeedback |
Implement a function to check whether a given array contains an odd number that is also a prime number or not.
array = [2, 3, 5, 9, 22, 13] | codefeedback |
You are tasked with creating a custom testing framework for a Rust project. The framework should be able to compile a set of test cases and verify that certain test cases fail to compile as expected. To achieve this, you need to implement a function that takes a directory path as input, searches for Rust source files w... | codefeedback |
What is the most efficient technique to ingest and interrogate massive CSV datasets using the Python programming language? | codefeedback |
Write a sample program that performs text classification | codefeedback |
Create a function `calculate_discount` to calculate a discount for a given price based on a given percentage. The function should only accept prices that are greater than or equal to 10. If the price is less than 10, the function should raise a `ValueError` with the message "Invalid price: price must be greater than or... | codefeedback |
Given a list of numbers, find the minimum and maximum elements. However, you must do this without using any built-in functions or methods for finding the minimum and maximum. Additionally, you must optimize your solution to have a time complexity of O(n), where n is the length of the list. You are also required to hand... | codefeedback |
Construct an anonymous function in Python's idiomatic programming environment, aiming to determine whether a given variable represents a prime number or rather a composite number, employing the modulus operator as a means for this differentiation. | codefeedback |
Implement the Collatz Conjecture in Python using a recursive function that returns the stopping time of a given natural number. The stopping time is defined as the number of iterations required to reach the number 1 starting from the given number. Additionally, output each intermediate number in the sequence for each i... | codefeedback |
Develop a Java program that counts the frequency of a given word in a sentence, taking into consideration that the sentence can contain multiple lines and the word can be present in different cases (e.g., "Code", "CODE", "code").
Input: sentence = "I am learning to Code.\nCode is fun to learn.\nI love coding!", word = ... | codefeedback |
Propose a method to not only pinpoint but also systematically eliminate all recurring instances present within the given numerical array. Here's your test array: numbers = [2, 3, 2, 5, 8, 3, 10]. The method should ensure no loss in original element order and must work for any type of lists not just integers. | codefeedback |
Generate a correct SQL statement to select the employees with their name, gender, age and salary | codefeedback |
Given a list of tuples representing a tree structure, where each tuple contains two elements: the value of a node and a list of its children, output the tree structure in Python. The output should include the parent-child relationship, indentation to indicate the level of each node, and the number of descendants for ea... | codefeedback |
You are tasked with implementing a genetic algorithm to optimize the parameters of a group of agents. The genetic algorithm will run for a specified number of generations, and each generation will consist of a certain number of agents. The goal is to find the best combination of parameters for the agents to maximize a ... | codefeedback |
Create a script to multiply each element in a list by 10, without using the multiplication operator (*) and with a space complexity of O(1). The solution should also handle negative numbers in the input list. | codefeedback |
Consider the unending polynomial series $A_F(x) = x F_1 + x^2 F_2 + x^3 F_3 + \dots$, where $F_k$ signifies the $k$th term in the Fibonacci sequence: $1, 1, 2, 3, 5, 8, \dots$; that is, $F_k = F_{k-1} + F_{k-2}$, $F_1 = 1$ and $F_2 = 1$.
Our focus for this problem will be on those values of $x$ for which $A_F(x)$ is a ... | codefeedback |
What is the Big-O notation of a given algorithm | codefeedback |
Given a database table named "Products" with the following columns: "product_id" (integer), "product_name" (string), "product_price" (decimal), and "product_category" (string), write a SQL query that retrieves the maximum price for each product in each category.
Additional Instructions:
1. The table may contain multip... | codefeedback |
You are tasked with implementing a memory game algorithm. In this game, players take turns modifying an array of integers according to specific rules. The game starts with a given array of integers and a specified number of turns. On each turn, the player performs the following steps:
1. If the array is empty, the game... | codefeedback |
Devise a coding sequence in the programming language known as JavaScript that simulates the process of tossing a coin to yield heads or tails. | codefeedback |
create a function that calculates the total cost of a meal including taxes and tips, but with the following specific requirements:
- The sales tax rate can be any decimal value between 0 and 1, inclusive.
- The tip percentage can be any decimal value between 0 and 1, inclusive.
- The meal price can be any positive deci... | codefeedback |
You are tasked with creating a reinforcement learning environment for training an agent to play a simple game. The game environment is represented by a grid, where the agent can move in four directions: up, down, left, and right. The goal of the agent is to reach a specific target location within the grid while avoidin... | codefeedback |
Develop a command to isolate all books published after a particular year.
year: 1980 | codefeedback |
Create an HTML page that includes a dynamically generated chart using data fetched from an API. The chart should display real-time updates every 5 seconds. Additionally, implement a feature that allows the user to filter the chart data based on specific criteria.
Erroneous code reference:
In the dynamically generated ... | codefeedback |
Create a MySQL query that finds customers who made a payment of more than $100, have not made any refunds in the last 30 days, and have made at least 5 purchases in total. | codefeedback |
You are tasked with implementing a custom layer in a neural network model using the Keras library in Python. The provided code snippet is a part of a larger neural network architecture and demonstrates the addition of a batch normalization layer, activation function, and dropout layer to the model.
Your task is to cre... | codefeedback |
You are tasked with creating a Python program to manage a database of cards for a digital card collection. The program should allow users to create a new card, retrieve information about a specific card, and list all the cards in the database.
Your program should utilize SQLite to store the card information. Each card... | codefeedback |
Write an SQL query to retrieve all students from the table "Students" who have scored more than 90 marks, belong to a specific department "Computer Science", and order them by their "grade" in descending order. Additionally, the query should only include students whose enrollment year is after 2018 and their "grade" sh... | codefeedback |
Imagine this SVG is a living creature. Can you make it look like it's breathing or pulsating?
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="30" y="30" width="28" height="28" rx="4" transform="rotate(-180 30 30)" fill="#8D65C5"/>
<path d="M22.8239 24.485C22.9336... | codefeedback |
Print a pyramid of stars that has 10 levels. | codefeedback |
Combine and sort two or more given arrays with different data types into one sorted array without using built-in sorting functions.
The sorting should be done considering the following criteria:
1. Numbers have higher priority than strings.
2. Data should be sorted in ascending order for same data types.
3. Arrays can... | codefeedback |
There's a lot of people today who sell unittesting as bread-and-butter of development. That might even work for strongly algorithmically-oriented routines. However, how would you unit-test, for example, a memory allocator (think malloc()/realloc()/free()). It's not hard to produce a working (but absolutely useless) m... | codefeedback |
We need to find all unique combinations of at least 2 elements from a given list of items, such that the sum of the combination is equal to a given target value. Additionally, each combination should not contain any duplicate elements.
List: [1, 2, 3, 4]
Target value: 10 | codefeedback |
You are given a 2D maze represented by a 2D array of characters. The maze consists of cells, some of which are blocked (denoted by 'X') and others are open (denoted by '0'). The objective is to find a path from the top-left corner of the maze to the bottom-right corner, moving only right or down, and avoiding the block... | codefeedback |
Design a comprehensive data lake infrastructure that enables the seamless migration of data from IoT devices to Amazon's Redshift. Following this, formulate intricate SQL queries to meticulously scrutinize and interpret patterns and activities exhibited by these devices, while also considering potential correlations an... | codefeedback |
Write a HTML form to take in multiple user inputs, validate the inputs, perform a series of calculations on the inputs, and display the results. The form should include additional fields for the user to select the type of calculations to perform (addition, subtraction, multiplication, or division) and the number of dec... | codefeedback |
Remove all HTML tags from a string, but also remove any content inside the tags. Additionally, convert all HTML entities to their corresponding characters. Finally, ensure that the output string is sorted alphabetically, each word is capitalized, and there are no duplicate words.
Input: "<h1>Hello & <strong>World</... | codefeedback |
Construct a MongoDB operation to deduce the median compensation of employees within your specific occupational sector in the field of Data Science or Software Engineering. Additionally, calculate the mode and range of the salaries and handle any outliers by using a 1.5 interquartile range rule. | codefeedback |
You are tasked with creating a Python function that processes a list of dictionaries representing software units. Each dictionary contains information about the unit, including a list of binary file paths. Your function should iterate through each unit, modify the file permissions of the binaries, and return the update... | codefeedback |
You need to generate an array of strings of length 10 to 15 characters, where each string consists of only lowercase alphabets (a-z). Additionally, the generated strings should not contain any repeating characters. The time complexity of your solution should not exceed O(n), where n is the length of the generated array... | codefeedback |
Using Python programming language, create a function that can identify the pattern of the numbered sequence 1, 4, 7, 10, etc., and output the formula for generating the sequence. The function should also be able to handle sequences of any length, with any starting number and common difference. Additionally, provide a d... | codefeedback |
Write a function to check if a binary tree is balanced. A binary tree is considered balanced if the heights of its left and right subtrees differ by no more than 1. The function should return True if the tree is balanced, and False otherwise.
Additionally, the function should also print all the nodes in the tree in i... | codefeedback |
How to remove the last two characters of a string in Python without using built-in string methods?
word = "Hello"
#Erroneous Code#
word = word[:-2] | codefeedback |
You are tasked with implementing a function that simulates the rolling of three dice and determines the outcome based on the values rolled. Each die has six faces, numbered from 1 to 6. The function should take the values of the three dice as input and return a string indicating the outcome of the roll.
The outcomes a... | codefeedback |
Implement a program that applies the following transformations to a given chain of characters:
- Interchange the initial and subsequent alphabetic symbols.
- If the character is a consonant, change it to the next consonant in the alphabet. If the character is a vowel, change it to the next vowel.
- Reverse the order o... | codefeedback |
Create a list comprehension expression to generate a list of the squares of all even numbers from 1 to 10. | codefeedback |
Implement a function that takes in two strings as input and reverses the order of their characters while maintaining the same character at each index. The length of each string will be at most 100 characters. The function should return the reversed strings concatenated together with a hyphen in between. If the length o... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.