id
stringlengths
11
14
content
stringlengths
424
1.17M
apps_data_2700
## Your Story "A *piano* in the home meant something." - *Fried Green Tomatoes at the Whistle Stop Cafe* You've just realized a childhood dream by getting a beautiful and beautiful-sounding upright piano from a friend who was leaving the country. You immediately started doing things like playing "Heart and Soul" over ...
apps_data_2701
# A History Lesson Tetris is a puzzle video game originally designed and programmed by Soviet Russian software engineer Alexey Pajitnov. The first playable version was completed on June 6, 1984. Pajitnov derived its name from combining the Greek numerical prefix tetra- (the falling pieces contain 4 segments) and tenni...
apps_data_2702
# Task You are given two strings s and t of the same length, consisting of uppercase English letters. Your task is to find the minimum number of "replacement operations" needed to get some `anagram` of the string t from the string s. A replacement operation is performed by picking exactly one character from the string...
apps_data_2703
Complete the square sum function so that it squares each number passed into it and then sums the results together. For example, for `[1, 2, 2]` it should return `9` because `1^2 + 2^2 + 2^2 = 9`. ```if:racket In Racket, use a list instead of an array, so '(1 2 3) should return 9. ``` def square_sum(numbers): ret...
apps_data_2704
# Task Given a `sequence` of integers, check whether it is possible to obtain a strictly increasing sequence by erasing no more than one element from it. # Example For `sequence = [1, 3, 2, 1]`, the output should be `false`; For `sequence = [1, 3, 2]`, the output should be `true`. # Input/Output - `[input]` ...
apps_data_2705
## Task Write a function that accepts two arguments and generates a sequence containing the integers from the first argument to the second inclusive. ## Input Pair of integers greater than or equal to `0`. The second argument will always be greater than or equal to the first. ## Example ```python generate_intege...
apps_data_2706
# Story&Task There are three parties in parliament. The "Conservative Party", the "Reformist Party", and a group of independants. You are a member of the “Conservative Party” and you party is trying to pass a bill. The “Reformist Party” is trying to block it. In order for a bill to pass, it must have a majority vo...
apps_data_2707
*This kata is based on [Project Euler Problem 539](https://projecteuler.net/problem=539)* ##Object Find the last number between 1 and `n` (inclusive) that survives the elimination process ####How It Works Start with the first number on the left then remove every other number moving right until you reach the the end...
apps_data_2708
Write a code that receives an array of numbers or strings, goes one by one through it while taking one value out, leaving one value in, taking, leaving, and back again to the beginning until all values are out. It's like a circle of people who decide that every second person will leave it, until the last person is th...
apps_data_2709
Write a function `take_umbrella()` that takes two arguments: a string representing the current weather and a float representing the chance of rain today. Your function should return `True` or `False` based on the following criteria. * You should take an umbrella if it's currently raining or if it's cloudy and the cha...
apps_data_2710
Write a program that, given a word, computes the scrabble score for that word. ## Letter Values You'll need these: ``` Letter Value A, E, I, O, U, L, N, R, S, T 1 D, G 2 B, C, M, P 3 F, H, V, W, Y 4 K ...
apps_data_2711
You have n dices each one having s sides numbered from 1 to s. How many outcomes add up to a specified number k? For example if we roll four normal six-sided dices we have four outcomes that add up to 5. (1, 1, 1, 2) (1, 1, 2, 1) (1, 2, 1, 1) (2, 1, 1, 1) def outcome(n, s, k): if n == 1: return 1 if 0 < k <...
apps_data_2712
# One is the loneliest number ## Task The range of vision of a digit is its own value. `1` can see one digit to the left and one digit to the right,` 2` can see two digits, and so on. Thus, the loneliness of a digit `N` is the sum of the digits which it can see. Given a non-negative integer, your funtion must deter...
apps_data_2713
Many years ago, Roman numbers were defined by only `4` digits: `I, V, X, L`, which represented `1, 5, 10, 50`. These were the only digits used. The value of a sequence was simply the sum of digits in it. For instance: ``` IV = VI = 6 IX = XI = 11 XXL = LXX = XLX = 70 ``` It is easy to see that this system is ambiguous,...
apps_data_2714
There are just some things you can't do on television. In this case, you've just come back from having a "delicious" Barth burger and you're set to give an interview. The Barth burger has made you queezy, and you've forgotten some of the import rules of the "You Can't Do That on Television" set. If you say any of the ...
apps_data_2715
# Introduction You are the developer working on a website which features a large counter on its homepage, proudly displaying the number of happy customers who have downloaded your companies software. You have been tasked with adding an effect to this counter to make it more interesting. Instead of just displaying ...
apps_data_2716
**Step 1:** Create a function called `encode()` to replace all the lowercase vowels in a given string with numbers according to the following pattern: ``` a -> 1 e -> 2 i -> 3 o -> 4 u -> 5 ``` For example, `encode("hello")` would return `"h2ll4"`. There is no need to worry about uppercase vowels in this kata. **Step...
apps_data_2717
Given an array of integers, return the smallest common factors of all integers in the array. When i say **Smallest Common Factor** i mean the smallest number above 1 that can divide all numbers in the array without a remainder. If there are no common factors above 1, return 1 (technically 1 is always a common factor)...
apps_data_2718
# Task Timed Reading is an educational tool used in many schools to improve and advance reading skills. A young elementary student has just finished his very first timed reading exercise. Unfortunately he's not a very good reader yet, so whenever he encountered a word longer than maxLength, he simply skipped it and re...
apps_data_2719
This kata is all about adding numbers. You will create a function named add. This function will return the sum of all the arguments. Sounds easy, doesn't it?? Well here's the twist. The inputs will gradually increase with their index as parameter to the function. ```python add(3,4,5) #returns (3*1)+(4*2)+(5*3)=26 ...
apps_data_2720
In the following 6 digit number: ``` 283910 ``` `91` is the greatest sequence of 2 consecutive digits. In the following 10 digit number: ``` 1234567890 ``` `67890` is the greatest sequence of 5 consecutive digits. Complete the solution so that it returns the greatest sequence of five consecutive digits found withi...
apps_data_2721
The task is very simple. You must to return pyramids. Given a number ```n``` you print a pyramid with ```n``` floors For example , given a ```n=4``` you must to print this pyramid: ``` /\ / \ / \ /______\ ``` Other example, given a ```n=6``` you must to print this pyramid: ``` /\ / \ ...
apps_data_2722
Complete the function/method so that it returns the url with anything after the anchor (`#`) removed. ## Examples ```python # returns 'www.codewars.com' remove_url_anchor('www.codewars.com#about') # returns 'www.codewars.com?page=1' remove_url_anchor('www.codewars.com?page=1') ``` def remove_url_anchor(url): r...
apps_data_2723
You are given a string of numbers between 0-9. Find the average of these numbers and return it as a floored whole number (ie: no decimal places) written out as a string. Eg: "zero nine five two" -> "four" If the string is empty or includes a number greater than 9, return "n/a" N = ['zero','one','two','three','four',...
apps_data_2724
Modify the `kebabize` function so that it converts a camel case string into a kebab case. Notes: - the returned string should only contain lowercase letters def kebabize(s): return ''.join(c if c.islower() else '-' + c.lower() for c in s if c.isalpha()).strip('-') def kebabize(string): result = "" ...
apps_data_2725
As a part of this Kata, you need to create a function that when provided with a triplet, returns the index of the numerical element that lies between the other two elements. The input to the function will be an array of three distinct numbers (Haskell: a tuple). For example: gimme([2, 3, 1]) => 0 *2* is the num...
apps_data_2726
Given an integer, if the length of it's digits is a perfect square, return a square block of sqroot(length) * sqroot(length). If not, simply return "Not a perfect square!". Examples: 1212 returns: >1212 Note: 4 digits so 2 squared (2x2 perfect square). 2 digits on each line. 123123123 returns: >123123123 Note:...
apps_data_2727
# Task Given string `s`, which contains only letters from `a to z` in lowercase. A set of alphabet is given by `abcdefghijklmnopqrstuvwxyz`. 2 sets of alphabets mean 2 or more alphabets. Your task is to find the missing letter(s). You may need to output them by the order a-z. It is possible that there is more ...
apps_data_2728
A common problem in number theory is to find x given a such that: a * x = 1 mod [n] Then x is called the inverse of a modulo n. Your goal is to code a function inverseMod wich take a and n as parameters and return x. You may be interested by these pages: http://en.wikipedia.org/wiki/Modular_multiplicative_invers...
apps_data_2729
A few years ago, Aaron left his old school and registered at another due to security reasons. Now he wishes to find Jane, one of his schoolmates and good friends. There are `n` schools numbered from 1 to `n`. One can travel between each pair of schools by buying a ticket. The ticket between schools `i` and `j` costs `...
apps_data_2730
The new "Avengers" movie has just been released! There are a lot of people at the cinema box office standing in a huge line. Each of them has a single `100`, `50` or `25` dollar bill. An "Avengers" ticket costs `25 dollars`. Vasya is currently working as a clerk. He wants to sell a ticket to every single person in thi...
apps_data_2731
###Instructions Write a function that takes a negative or positive integer, which represents the number of minutes before (-) or after (+) Sunday midnight, and returns the current day of the week and the current time in 24hr format ('hh:mm') as a string. ```python day_and_time(0) should return 'Sunday 00:00' d...
apps_data_2732
## Task You will receive a string consisting of lowercase letters, uppercase letters and digits as input. Your task is to return this string as blocks separated by dashes (`"-"`). The elements of a block should be sorted with respect to the hierarchy listed below, and each block cannot contain multiple instances of th...
apps_data_2733
Given a string of words (x), you need to return an array of the words, sorted alphabetically by the final character in each. If two words have the same last letter, they returned array should show them in the order they appeared in the given string. All inputs will be valid. def last(s): return sorted(s.split(),...
apps_data_2734
## The story you are about to hear is true Our cat, Balor, sadly died of cancer in 2015. While he was alive, the three neighborhood cats Lou, Mustache Cat, and Raoul all recognized our house and yard as Balor's territory, and would behave respectfully towards him and each other when they would visit. But after Balor...
apps_data_2735
# Definition **_Jumping number_** is the number that *All adjacent digits in it differ by 1*. ____ # Task **_Given_** a number, **_Find if it is Jumping or not_** . ____ # Warm-up (Highly recommended) # [Playing With Numbers Series](https://www.codewars.com/collections/playing-with-numbers) ___ # Notes * **_N...
apps_data_2736
Create a function that takes a list of one or more non-negative integers, and arranges them such that they form the largest possible number. Examples: `largestArrangement([4, 50, 8, 145])` returns 8504145 (8-50-4-145) `largestArrangement([4, 40, 7])` returns 7440 (7-4-40) `largestArrangement([4, 46, 7])` returns 74...
apps_data_2737
You are given an array that of arbitrary depth that needs to be nearly flattened into a 2 dimensional array. The given array's depth is also non-uniform, so some parts may be deeper than others. All of lowest level arrays (most deeply nested) will contain only integers and none of the higher level arrays will contain ...
apps_data_2738
An Ironman Triathlon is one of a series of long-distance triathlon races organized by the World Triathlon Corporaion (WTC). It consists of a 2.4-mile swim, a 112-mile bicycle ride and a marathon (26.2-mile) (run, raced in that order and without a break. It hurts... trust me. Your task is to take a distance that an ath...
apps_data_2739
Find the sum of the odd numbers within an array, after cubing the initial integers. The function should return `undefined`/`None`/`nil`/`NULL` if any of the values aren't numbers. ~~~if:java,csharp Note: There are ONLY integers in the JAVA and C# versions of this Kata. ~~~ ~~~if:python Note: Booleans should not be c...
apps_data_2740
# Scenario With **_Cereal crops_** like wheat or rice, before we can eat the grain kernel, we need to remove that inedible hull, or *to separate the wheat from the chaff*. ___ # Task **_Given_** a *sequence of n integers* , **_separate_** *the negative numbers (chaff) from positive ones (wheat).* ___ # Notes * *...
apps_data_2741
The "Russian Peasant Method" is an old algorithm used by Russian peasants (and before them ancient Egyptians) to perform multiplication. Consider that X and Y are two numbers. X can be any number but Y must be a positive integer. To multiply X and Y: 1. Let the product = 0 2. If Y is odd, then the product = product ...
apps_data_2742
Given a string and an array of index numbers, return the characters of the string rearranged to be in the order specified by the accompanying array. Ex: scramble('abcd', [0,3,1,2]) -> 'acdb' The string that you will be returning back will have: 'a' at index 0, 'b' at index 3, 'c' at index 1, 'd' at index 2, because...
apps_data_2743
Program a function `sumAverage(arr)` where `arr` is an array containing arrays full of numbers, for example: ```python sum_average([[1, 2, 2, 1], [2, 2, 2, 1]]) ``` First, determine the average of each array. Then, return the sum of all the averages. - All numbers will be less than 100 and greater than -100. - `arr`...
apps_data_2744
Create a function that interprets code in the esoteric language **Poohbear** ## The Language Poohbear is a stack-based language largely inspired by Brainfuck. It has a maximum integer value of 255, and 30,000 cells. The original intention of Poohbear was to be able to send messages that would, to most, be completely ...
apps_data_2745
The Tower of Hanoi problem involves 3 towers. A number of rings decreasing in size are placed on one tower. All rings must then be moved to another tower, but at no point can a larger ring be placed on a smaller ring. Your task: Given a number of rings, return the MINIMUM number of moves needed to move all the ring...
apps_data_2746
Check if it is a vowel(a, e, i, o, u,) on the ```n``` position in a string (the first argument). Don't forget about uppercase. A few cases: ``` { checkVowel('cat', 1) -> true // 'a' is a vowel checkVowel('cat', 0) -> false // 'c' is not a vowel checkVowel('cat', 4) -> false // this position doesn't exist } `...
apps_data_2747
We are given a sequence of coplanar points and see all the possible triangles that may be generated which all combinations of three points. We have the following list of points with the cartesian coordinates of each one: ``` Points [x, y] A [1, 2] B [3, 3] C [4, 1] D [1, 1] E [4, -1] ``` With ...
apps_data_2748
Given: an array containing hashes of names Return: a string formatted as a list of names separated by commas except for the last two names, which should be separated by an ampersand. Example: ``` ruby list([ {name: 'Bart'}, {name: 'Lisa'}, {name: 'Maggie'} ]) # returns 'Bart, Lisa & Maggie' list([ {name: 'Bart'}, {...
apps_data_2749
In this Kata, you will be given an array and your task will be to determine if an array is in ascending or descending order and if it is rotated or not. Consider the array `[1,2,3,4,5,7,12]`. This array is sorted in `Ascending` order. If we rotate this array once to the left, we get `[12,1,2,3,4,5,7]` and twice-rotat...
apps_data_2750
# Task You are given a positive integer `n`. We intend to make some ascending sequences according to the following rules: 1. Make a sequence of length 1: [ n ] 2. Or, insert a number to the left side of the sequence. But this number can not exceed half of the first number of the sequence. 3. Follow rule 2, cont...
apps_data_2751
Write a method that will search an array of strings for all strings that contain another string, ignoring capitalization. Then return an array of the found strings. The method takes two parameters, the query string and the array of strings to search, and returns an array. If the string isn't contained in any of the...
apps_data_2752
Given a sorted array of numbers, return the summary of its ranges. ## Examples ```python summary_ranges([1, 2, 3, 4]) == ["1->4"] summary_ranges([1, 1, 1, 1, 1]) == ["1"] summary_ranges([0, 1, 2, 5, 6, 9]) == ["0->2", "5->6", "9"] summary_ranges([0, 1, 2, 3, 3, 3, 4, 5, 6, 7]) == ["0->7"] summary_ranges([0, 1, 2, 3, 3...
apps_data_2753
KISS stands for Keep It Simple Stupid. It is a design principle for keeping things simple rather than complex. You are the boss of Joe. Joe is submitting words to you to publish to a blog. He likes to complicate things. Define a function that determines if Joe's work is simple or complex. Input will be non emtpy st...
apps_data_2754
Oh no! You have stumbled upon a mysterious signal consisting of beeps of various lengths, and it is of utmost importance that you find out the secret message hidden in the beeps. There are long and short beeps, the longer ones roughly three times as long as the shorter ones. Hmm... that sounds familiar. That's righ...
apps_data_2755
Return a new array consisting of elements which are multiple of their own index in input array (length > 1). Some cases: ``` [22, -6, 32, 82, 9, 25] => [-6, 32, 25] [68, -1, 1, -7, 10, 10] => [-1, 10] [-56,-85,72,-26,-14,76,-27,72,35,-21,-67,87,0,21,59,27,-92,68] => [-85, 72, 0, 68] ``` def multiple_of_index(l):...
apps_data_2756
The number `1035` is the smallest integer that exhibits a non frequent property: one its multiples, `3105 = 1035 * 3`, has its same digits but in different order, in other words, `3105`, is one of the permutations of `1035`. The number `125874` is the first integer that has this property when the multiplier is `2`, th...
apps_data_2757
Your users passwords were all stole in the Yahoo! hack, and it turns out they have been lax in creating secure passwords. Create a function that checks their new password (passed as a string) to make sure it meets the following requirements: Between 8 - 20 characters Contains only the following characters: (and at ...
apps_data_2758
## Welcome to my (amazing) kata! You are given a gigantic number to decode. Each number is a code that alternates in a pattern between encoded text and a smaller, encoded number. The pattern's length varies with every test, but the alternation between encoded text and an encoded number will always be there. Followi...
apps_data_2759
```if-not:ruby Create a function, that accepts an arbitrary number of arrays and returns a single array generated by alternately appending elements from the passed in arguments. If one of them is shorter than the others, the result should be padded with empty elements. ``` ```if:ruby Create a function, that accepts an ...
apps_data_2760
How many licks does it take to get to the tootsie roll center of a tootsie pop? A group of engineering students from Purdue University reported that its licking machine, modeled after a human tongue, took an average of 364 licks to get to the center of a Tootsie Pop. Twenty of the group's volunteers assumed the lickin...
apps_data_2761
Find the length between 2 co-ordinates. The co-ordinates are made of integers between -20 and 20 and will be given in the form of a 2D array: (0,0) and (5,-7) would be [ [ 0 , 0 ] , [ 5, -7 ] ] The function must return the answer rounded to 2 decimal places in the form of a string. ```python length_of_line([[0, 0],...
apps_data_2762
You are working at a lower league football stadium and you've been tasked with automating the scoreboard. The referee will shout out the score, you have already set up the voice recognition module which turns the ref's voice into a string, but the spoken score needs to be converted into a pair for the scoreboard! e.g...
apps_data_2763
In mathematics, a [Diophantine equation](https://en.wikipedia.org/wiki/Diophantine_equation) is a polynomial equation, usually with two or more unknowns, such that only the integer solutions are sought or studied. In this kata we want to find all integers `x, y` (`x >= 0, y >= 0`) solutions of a diophantine equation o...
apps_data_2764
We are interested in collecting the triples of positive integers ```(a, b, c)``` that fulfill the following equation: ```python a² + b² = c³ ``` The first triple with the lowest values that satisfies the equation we have above is (2, 2 ,2). In effect: ```python 2² + 2² = 2³ 4 + 4 = 8 ``` The first pair of triples tha...
apps_data_2765
Cascading Style Sheets (CSS) is a style sheet language used for describing the look and formatting of a document written in a markup language. A style sheet consists of a list of rules. Each rule or rule-set consists of one or more selectors, and a declaration block. Selector describes which element it matches. Someti...
apps_data_2766
The number `198` has the property that `198 = 11 + 99 + 88, i.e., if each of its digits is concatenated twice and then summed, the result will be the original number`. It turns out that `198` is the only number with this property. However, the property can be generalized so that each digit is concatenated `n` times and...
apps_data_2767
DNA sequencing data can be stored in many different formats. In this Kata, we will be looking at SAM formatting. It is a plain text file where every line (excluding the first header lines) contains data about a "read" from whatever sample the file comes from. Rather than focusing on the whole read, we will take two pie...
apps_data_2768
Consider a sequence generation that follows the following steps. We will store removed values in variable `res`. Assume `n = 25`: ```Haskell -> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] Let's remove the first number => res = [1]. We get.. -> [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21...
apps_data_2769
# Task Consider the following ciphering algorithm: ``` For each character replace it with its code. Concatenate all of the obtained numbers. ``` Given a ciphered string, return the initial one if it is known that it consists only of lowercase letters. Note: here the character's code means its `decimal ASCII code`, t...
apps_data_2770
One suggestion to build a satisfactory password is to start with a memorable phrase or sentence and make a password by extracting the first letter of each word. Even better is to replace some of those letters with numbers (e.g., the letter `O` can be replaced with the number `0`): * instead of including `i` or `I` p...
apps_data_2771
Hofstadter sequences are a family of related integer sequences, among which the first ones were described by an American professor Douglas Hofstadter in his book Gödel, Escher, Bach. ### Task Today we will be implementing the rather chaotic recursive sequence of integers called Hofstadter Q. The Hofstadter Q is defin...
apps_data_2772
It's 3AM and you get the dreaded call from a customer: the program your company sold them is hanging. You eventually trace the problem down to a call to a function named `mystery`. Usually, `mystery` works fine and produces an integer result for an integer input. However, on certain inputs, the `mystery` function just ...
apps_data_2773
Mr. Scrooge has a sum of money 'P' that he wants to invest. Before he does, he wants to know how many years 'Y' this sum 'P' has to be kept in the bank in order for it to amount to a desired sum of money 'D'. The sum is kept for 'Y' years in the bank where interest 'I' is paid yearly. After paying taxes 'T' for the ye...
apps_data_2774
### Background We **all** know about "balancing parentheses" (plus brackets, braces and chevrons) and even balancing characters that are identical. Read that last sentence again, I balanced different characters and identical characters twice and you didn't even notice... :) ### Kata Your challenge in this kata is ...
apps_data_2775
You probably know the "like" system from Facebook and other pages. People can "like" blog posts, pictures or other items. We want to create the text that should be displayed next to such an item. Implement a function `likes :: [String] -> String`, which must take in input array, containing the names of people who like...
apps_data_2776
Your task is to convert a given number into a string with commas added for easier readability. The number should be rounded to 3 decimal places and the commas should be added at intervals of three digits before the decimal point. There does not need to be a comma at the end of the number. You will receive both positi...
apps_data_2777
Consider the following expansion: ```Haskell solve("3(ab)") = "ababab" -- "ab" repeats 3 times solve("2(a3(b))" = "abbbabbb" -- "a3(b)" == "abbb" repeats twice. ``` Given a string, return the expansion of that string. Input will consist of only lowercase letters and numbers (1 to 9) in valid parenthesis. There will ...
apps_data_2778
A faro shuffle of a deck of playing cards is a shuffle in which the deck is split exactly in half and then the cards in the two halves are perfectly interwoven, such that the original bottom card is still on the bottom and the original top card is still on top. For example, faro shuffling the list ```python ['ace', 't...
apps_data_2779
In his publication Liber Abaci Leonardo Bonacci, aka Fibonacci, posed a problem involving a population of idealized rabbits. These rabbits bred at a fixed rate, matured over the course of one month, had unlimited resources, and were immortal. Beginning with one immature pair of these idealized rabbits that produce b p...
apps_data_2780
Chingel is practicing for a rowing competition to be held on this saturday. He is trying his best to win this tournament for which he needs to figure out how much time it takes to cover a certain distance. **Input** You will be provided with the total distance of the journey, speed of the boat and whether he is goin...
apps_data_2781
##Background - the Collatz Conjecture: Imagine you are given a positive integer, `n`, then: * if `n` is even, calculate: `n / 2` * if `n` is odd, calculate: `3 * n + 1` Repeat until your answer is `1`. The Collatz conjecture states that performing this operation repeatedly, you will always eventually reach `1`. You...
apps_data_2782
Your job is to create a calculator which evaluates expressions in [Reverse Polish notation](http://en.wikipedia.org/wiki/Reverse_Polish_notation). For example expression `5 1 2 + 4 * + 3 -` (which is equivalent to `5 + ((1 + 2) * 4) - 3` in normal notation) should evaluate to `14`. For your convenience, the input is ...
apps_data_2783
## Grade book Complete the function so that it finds the mean of the three scores passed to it and returns the letter value associated with that grade. Numerical Score | Letter Grade --- | --- 90 <= score <= 100 | 'A' 80 <= score < 90 | 'B' 70 <= score < 80 | 'C' 60 <= score < 70 | 'D' 0 <= s...
apps_data_2784
Here we have a function that help us spam our hearty laughter. But is not working! I need you to find out why... Expected results: ```python spam(1) ==> "hue" spam(6) ==> "huehuehuehuehuehue" spam(14) ==> "huehuehuehuehuehuehuehuehuehuehuehuehuehue" ``` #fix this code! def spam(number): return 'hue' * number ...
apps_data_2785
# Task Let's define a `parameter` of number `n` as the least common multiple (LCM) of the sum of its digits and their product. Calculate the parameter of the given number `n`. # Input/Output `[input]` integer `n` A positive integer. It is guaranteed that no zero appears in `n`. `[output]` an integer The paramet...
apps_data_2786
If I give you a date, can you tell me what day that date is? For example, december 8th, 2015 is a tuesday. Your job is to write the function ```day(d)``` which takes a string representation of a date as input, in the format YYYYMMDD. The example would be "20151208". The function needs to output the string representati...
apps_data_2787
You're familiar with [list slicing](https://docs.python.org/3/library/functions.html#slice) in Python and know, for example, that: ```python >>> ages = [12, 14, 63, 72, 55, 24] >>> ages[2:4] [63, 72] >>> ages[2:] [63, 72, 55, 24] >>> ages[:3] [12, 14, 63] ``` write a function `inverse_slice()` that takes three argume...
apps_data_2788
Write a function that returns a sequence (index begins with 1) of all the even characters from a string. If the string is smaller than two characters or longer than 100 characters, the function should return "invalid string". For example: ````` "abcdefghijklm" --> ["b", "d", "f", "h", "j", "l"] "a" --> "i...
apps_data_2789
Write function bmi that calculates body mass index (bmi = weight / height ^ 2). if bmi <= 18.5 return "Underweight" if bmi <= 25.0 return "Normal" if bmi <= 30.0 return "Overweight" if bmi > 30 return "Obese" def bmi(weight, height): bmi = weight / height ** 2 if bmi <= 18.5: return "Underweight" ...
apps_data_2790
In this Kata, you will be given an array of strings and your task is to remove all consecutive duplicate letters from each string in the array. For example: * `dup(["abracadabra","allottee","assessee"]) = ["abracadabra","alote","asese"]`. * `dup(["kelless","keenness"]) = ["keles","kenes"]`. Strings will be ...
apps_data_2791
Trigrams are a special case of the n-gram, where n is 3. One trigram is a continious sequence of 3 chars in phrase. [Wikipedia](https://en.wikipedia.org/wiki/Trigram) - return all trigrams for the given phrase - replace spaces with \_ - return an empty string for phrases shorter than 3 Example: trigrams('the qu...
apps_data_2792
The citizens of Codeland read each word from right to left, meaning that lexicographical comparison works differently in their language. Namely, string ```a``` is lexicographically smaller than string ```b``` if either: ```a``` is a suffix of ```b``` (in common sense, i.e. ```b``` ends with a substring equal to ```a```...
apps_data_2793
# Your Task The city of Darkishland has a strange hotel with infinite rooms. The groups that come to this hotel follow the following rules: * At the same time only members of one group can rent the hotel. * Each group comes in the morning of the check-in day and leaves the hotel in the evening of the check-out day. ...
apps_data_2794
Philip's just turned four and he wants to know how old he will be in various years in the future such as 2090 or 3044. His parents can't keep up calculating this so they've begged you to help them out by writing a programme that can answer Philip's endless questions. Your task is to write a function that takes two par...
apps_data_2795
The cockroach is one of the fastest insects. Write a function which takes its speed in km per hour and returns it in cm per second, rounded down to the integer (= floored). For example: ```python cockroach_speed(1.08) == 30 ``` Note! The input is a Real number (actual type is language dependent) and is >= 0. The res...
apps_data_2796
Create a function which answers the question "Are you playing banjo?". If your name starts with the letter "R" or lower case "r", you are playing banjo! The function takes a name as its only argument, and returns one of the following strings: ``` name + " plays banjo" name + " does not play banjo" ``` Names given a...
apps_data_2797
Mobile Display Keystrokes Do you remember the old mobile display keyboards? Do you also remember how inconvenient it was to write on it? Well, here you have to calculate how much keystrokes you have to do for a specific word. This is the layout: Return the amount of keystrokes of input str (! only letters, digits ...
apps_data_2798
# altERnaTIng cAsE <=> ALTerNAtiNG CaSe Define `String.prototype.toAlternatingCase` (or a similar function/method *such as* `to_alternating_case`/`toAlternatingCase`/`ToAlternatingCase` in your selected language; **see the initial solution for details**) such that each lowercase letter becomes uppercase and each upper...
apps_data_2799
You're in ancient Greece and giving Philoctetes a hand in preparing a training exercise for Hercules! You've filled a pit with two different ferocious mythical creatures for Hercules to battle! The formidable **"Orthus"** is a 2 headed dog with 1 tail. The mighty **"Hydra"** has 5 heads and 1 tail. Before Hercules ...