formatted_conversations stringlengths 1.13k 138k |
|---|
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Complete the function that returns an array of length `n`, starting with the given number `x` and the squares of the previous number. If `n` is negative or zero, return an emp... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.An Arithmetic Progression is defined as one in which there is a constant difference between the consecutive terms of a given series of numbers. You are provided with consecuti... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Complete the function ```caffeineBuzz```, which takes a non-zero integer as it's one argument.
If the integer is divisible by 3, return the string ```"Java"```.
If the integ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are:
2332
110011
54322345... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Ahoy Matey!
Welcome to the seven seas.
You are the captain of a pirate ship.
You are in battle against the royal navy.
You have cannons at the ready.... or are they?
Your... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Dudka has `n` details. He must keep exactly 3 of them.
To do this, he performs the following operations until he has only 3 details left:
```
He numbers them.
He kee... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a function that takes a positive integer n, sums all the cubed values from 1 to n, and returns that sum.
Assume that the input n will always be a positive integer.
Exa... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Largest Rectangle in Background
Imagine a photo taken to be used in an advertisement. The background on the left of the motive is whitish and you want to write some text on... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You have a two-dimensional list in the following format:
```python
data = [[2, 5], [3, 4], [8, 7]]
```
Each sub-list contains two items, and each item in the sub-lists is an... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are going to be given a word. Your job will be to make sure that each character in that word has the exact same number of occurrences. You will return `true` if it is vali... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a function that takes one or more arrays and returns a new array of unique values in the order of the original provided arrays.
In other words, all values present from ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Brief
=====
Sometimes we need information about the list/arrays we're dealing with. You'll have to write such a function in this kata. Your function must provide the following... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In this kata you will have to modify a sentence so it meets the following rules:
convert every word backwards that is:
longer than 6 characters
OR
has 2 or more ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Let's consider a table consisting of `n` rows and `n` columns. The cell located at the intersection of the i-th row and the j-th column contains number i × j. The rows... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.If the first day of the month is a Friday, it is likely that the month will have an `Extended Weekend`. That is, it could have five Fridays, five Saturdays and five Sundays.
... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.It's the most hotly anticipated game of the school year - Gryffindor vs Slytherin! Write a function which returns the winning team.
You will be given two arrays with two val... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Imagine that you are given two sticks. You want to end up with three sticks of equal length. You are allowed to cut either or both of the sticks to accomplish this, and can th... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.A triangle is called an equable triangle if its area equals its perimeter. Return `true`, if it is an equable triangle, else return `false`. You will be provided with the leng... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.From Wikipedia : "The n-back task is a continuous performance task that is commonly used as an assessment in cognitive neuroscience to measure a part of working memory and wor... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.```if-not:julia,racket
Write a function that returns the total surface area and volume of a box as an array: `[area, volume]`
```
```if:julia
Write a function that returns the... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given two arrays `a` and `b` write a function `comp(a, b)` (`compSame(a, b)` in Clojure) that checks whether the two arrays have the "same" elements, with the same multiplicit... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Don't give me five!
In this kata you get the start number and the end number of a region and should return the count of all numbers except numbers with a 5 in it. The start... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Ronny the robot is watching someone perform the Cups and Balls magic trick. The magician has one ball and three cups, he shows Ronny which cup he hides the ball under (b), he ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# The museum of incredible dull things
The museum of incredible dull things wants to get rid of some exhibitions. Miriam, the interior architect, comes up with a plan to remo... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Your program will receive an array of complex numbers represented as strings. Your task is to write the `complexSum` function which have to return the sum as a string.
Compl... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are:
2332
110011
54322345... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Variation of this nice kata, the war has expanded and become dirtier and meaner; both even and odd numbers will fight with their pointy `1`s. And negative integers are coming ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Given a string `str`, reverse it omitting all non-alphabetic characters.
# Example
For `str = "krishan"`, the output should be `"nahsirk"`.
For `str = "ultr53o?n... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.- Input: Integer `n`
- Output: String
Example:
`a(4)` prints as
```
A
A A
A A A
A A
```
`a(8)` prints as
```
A
A A
A A ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In Math, an improper fraction is a fraction where the numerator (the top number) is greater than or equal to the denominator (the bottom number) For example: ```5/3``` (five t... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Goldbach's conjecture is one of the oldest and best-known unsolved problems in number theory and all of mathematics. It states:
Every even integer greater than 2 can be expre... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Consider a pyramid made up of blocks. Each layer of the pyramid is a rectangle of blocks, and the dimensions of these rectangles increment as you descend the pyramid. So, if a... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Implement a function, so it will produce a sentence out of the given parts.
Array of parts could contain:
- words;
- commas in the middle;
- multiple periods at the end.
Sen... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You're a statistics professor and the deadline for submitting your students' grades is tonight at midnight. Each student's grade is determined by their mean score across all o... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Converting a 24-hour time like "0830" or "2030" to a 12-hour time (like "8:30 am" or "8:30 pm") sounds easy enough, right? Well, let's see if you can do it!
You will have to... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.I assume most of you are familiar with the ancient legend of the rice (but I see wikipedia suggests [wheat](https://en.wikipedia.org/wiki/Wheat_and_chessboard_problem), for so... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a function called "filterEvenLengthWords".
Given an array of strings, "filterEvenLengthWords" returns an array containing only the elements of the given array whose len... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.### Tongues
Gandalf's writings have long been available for study, but no one has yet figured out what language they are written in. Recently, due to programming work by a ha... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Your task is to make function, which returns the sum of a sequence of integers.
The sequence is defined by 3 non-negative values: **begin**, **end**, **step**.
If **begin** ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are:
* 232
* 110011
* 543... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are given an initial 2-value array (x). You will use this to calculate a score.
If both values in (x) are numbers, the score is the sum of the two. If only one is a numbe... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Covfefe
Your are given a string. You must replace the word(s) `coverage` by `covfefe`, however, if you don't find the word `coverage` in the string, you must add `covfefe`... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Mr.Odd is my friend. Some of his common dialogues are “Am I looking odd?” , “It’s looking very odd” etc. Actually “odd” is his favorite word.
In this valentine when ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## Description
You've been working with a lot of different file types recently as your interests have broadened.
But what file types are you using the most? With this questi... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Base64 Numeric Translator
Our standard numbering system is (Base 10). That includes 0 through 9. Binary is (Base 2), only 1’s and 0’s. And Hexadecimal is (Base 16) (0, 1, ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.This kata aims to show the vulnerabilities of hashing functions for short messages.
When provided with a SHA-256 hash, return the value that was hashed. You are also given th... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.*Recreation of [Project Euler problem #6](https://projecteuler.net/problem=6)*
Find the difference between the sum of the squares of the first `n` natural numbers `(1 <= n <=... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In this Kata, you will be given two numbers, n and k and your task will be to return the k-digit array that sums to n and has the maximum possible GCD.
For example, given `n ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a mathematical equation that has `*,+,-,/`, reverse it as follows:
```Haskell
solve("100*b/y") = "y/b*100"
solve("a+b-c/d*30") = "30*d/c-b+a"
```
More examples in test... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You have to create a function,named `insertMissingLetters`, that takes in a `string` and outputs the same string processed in a particular way.
The function should insert **o... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given n number of people in a room, calculate the probability that any two people in that room have the same birthday (assume 365 days every year = ignore leap year). Answers ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## Task:
Your task is to write a function which returns the sum of following series upto nth term(parameter).
Series: 1 + 1/4 + 1/7 + 1/10 + 1/13 + 1/16 +...
## Rules:... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
A robot is standing at the `(0, 0)` point of the Cartesian plane and is oriented towards the vertical (y) axis in the direction of increasing y values (in other words,... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Dee is lazy but she's kind and she likes to eat out at all the nice restaurants and gastropubs in town. To make paying quick and easy she uses a simple mental algorithm she's ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are given two positive integers ```a``` and ```b```.
You can perform the following operations on ```a``` so as to obtain ```b``` :
```
(a-1)/2 (if (a-1) is divisible by... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Write a function that accepts `msg` string and returns local tops of string from the highest to the lowest.
The string's tops are from displaying the string in the b... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.### Task
The __dot product__ is usually encountered in linear algebra or scientific computing. It's also called __scalar product__ or __inner product__ sometimes:
> In mathem... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In Dark Souls, players level up trading souls for stats. 8 stats are upgradable this way: vitality, attunement, endurance, strength, dexterity, resistance, intelligence, and f... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a non-negative number, return the next bigger polydivisible number, or an empty value like `null` or `Nothing`.
A number is polydivisible if its first digit is cleanly ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are currently in the United States of America. The main currency here is known as the United States Dollar (USD). You are planning to travel to another country for vacatio... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are given an array with several `"even"` words, one `"odd"` word, and some numbers mixed in.
Determine if any of the numbers in the array is the index of the `"odd"` word... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Jenny has written a function that returns a greeting for a user. However, she's in love with Johnny, and would like to greet him slightly different. She added a special case t... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You're re-designing a blog and the blog's posts have the following format for showing the date and time a post was made:
*Weekday* *Month* *Day*, *time*
e.g.,
Friday May 2,... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Your task is to write a function named `do_math` that receives a single argument.
This argument is a string that contains multiple whitespace delimited numbers. Each number h... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.###Task:
You have to write a function `pattern` which creates the following pattern (see examples) up to the desired number of rows.
* If the Argument is 0 or a Negative Int... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Round any given number to the closest 0.5 step
I.E.
```
solution(4.2) = 4
solution(4.3) = 4.5
solution(4.6) = 4.5
solution(4.8) = 5
```
Round **up** if number is as close to... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.At the annual family gathering, the family likes to find the oldest living family member’s age and the youngest family member’s age and calculate the difference between them.
... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.**Principal Diagonal** -- The principal diagonal in a matrix identifies those elements of the matrix running from North-West to South-East.
**Secondary Diagonal** -- the seco... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a function groupIn10s which takes any number of arguments, and groups them into sets of 10s and sorts each group in ascending order.
The return value should be an array... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Seven is a hungry number and its favourite food is number 9. Whenever it spots 9
through the hoops of 8, it eats it! Well, not anymore, because you are
going to help the 9 by... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Definition
An **_element is leader_** *if it is greater than The Sum all the elements to its right side*.
____
# Task
**_Given_** an *array/list [] of integers* , **_Find... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given an array of 4 integers
```[a,b,c,d]``` representing two points ```(a, b)``` and ```(c, d)```, return a string representation of the slope of the line joining these two... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In this Kata, you will be given a number and your task will be to return the nearest prime number.
```Haskell
solve(4) = 3. The nearest primes are 3 and 5. If difference is ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.This is a beginner friendly kata especially for UFC/MMA fans.
It's a fight between the two legends: Conor McGregor vs George Saint Pierre in Madison Square Garden. Only one ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Let's say that `"g" is happy` in the given string, if there is another "g" immediately to the right or to the left of it.
Find out if all "g"s in the given string a... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Create a program that will return whether an input value is a str, int, float, or bool. Return the name of the value.
### Examples
- Input = 23 --> Output = int
- Input = 2.3... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Introduction
The first century spans from the **year 1** *up to* and **including the year 100**, **The second** - *from the year 101 up to and including the year 200*, etc.... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Your boss decided to save money by purchasing some cut-rate optical character recognition software for scanning in the text of old novels to your database. At first it seems t... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You just got done with your set at the gym, and you are wondering how much weight you could lift if you did a single repetition. Thankfully, a few scholars have devised formul... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write
```python
remove(text, what)
```
that takes in a string ```str```(```text``` in Python) and an object/hash/dict/Dictionary ```what``` and returns a string with the chars... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a function getMean that takes as parameters an array (arr) and 2 integers (x and y). The function should return the mean between the mean of the the first x elements of ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.A number `n` is called `prime happy` if there is at least one prime less than `n` and the `sum of all primes less than n` is evenly divisible by `n`. Write `isPrimeHappy(n)` w... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In this Kata, you will count the number of times the first string occurs in the second.
```Haskell
solve("zaz","zazapulz") = 4 because they are ZAZapulz, ZAzapulZ, ZazApulZ,... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.There was a test in your class and you passed it. Congratulations!
But you're an ambitious person. You want to know if you're better than the average student in your class.
Y... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## Description
The task is described in the title: find the sum of all numbers with the same digits(permutations) **including** duplicates. However, due to the fact that this... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Introduction
Mr. Safety loves numeric locks and his Nokia 3310. He locked almost everything in his house. He is so smart and he doesn't need to remember the combinations. He... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.My friend John and I are members of the "Fat to Fit Club (FFC)". John is worried because
each month a list with the weights of members is published and each month he is the la... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a simple function that takes polar coordinates (an angle in degrees and a radius) and returns the equivalent cartesian coordinates (rouded to 10 places).
```
For exampl... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given few numbers, you need to print out the digits that are not being used.
Example:
```python
unused_digits(12, 34, 56, 78) # "09"
unused_digits(2015, 8, 26) # "3479"
```
... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Implement a function called makeAcronym that returns the first letters of each word in a passed in string.
Make sure the letters returned are uppercase.
If the value passed ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Description:
Replace the pair of exclamation marks and question marks to spaces(from the left to the right). A pair of exclamation marks and question marks must has the sa... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Consider the range `0` to `10`. The primes in this range are: `2, 3, 5, 7`, and thus the prime pairs are: `(2,2), (2,3), (2,5), (2,7), (3,3), (3,5), (3,7),(5,5), (5,7), (7,7)`... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In this kata, you will write a function that returns the positions and the values of the "peaks" (or local maxima) of a numeric array.
For example, the array `arr = [0, 1, 2,... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.For all x in the range of integers [0, 2 ** n), let y[x] be the binary exclusive-or of x and x // 2. Find the sum of all numbers in y.
Write a function sum_them that, given n... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Lеt's create function to play cards. Our rules:
We have the preloaded `deck`:
```
deck = ['joker','2♣','3♣','4♣','5♣','6♣','7♣','8♣','9♣','10♣','J♣','Q♣','K♣','A♣',
... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a function that takes two arguments, and returns a new array populated with the elements **that only appear once, in either one array or the other, taken only once**; di... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a comparator for a list of phonetic words for the letters of the [greek alphabet](https://en.wikipedia.org/wiki/Greek_alphabet).
A comparator is:
> *a custom comparison... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are the Dungeon Master for a public DnD game at your local comic shop and recently you've had some trouble keeping your players' info neat and organized so you've decided ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Chuck has lost count of how many asses he has kicked...
Chuck stopped counting at 100,000 because he prefers to kick things in the face instead of counting. That's just who h... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Implement a function which behaves like the uniq command in UNIX.
It takes as input a sequence and returns a sequence in which all duplicate elements following each other hav... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.