id
stringlengths
11
14
content
stringlengths
424
1.17M
apps_data_3200
When you divide the successive powers of `10` by `13` you get the following remainders of the integer divisions: `1, 10, 9, 12, 3, 4`. Then the whole pattern repeats. Hence the following method: Multiply the right most digit of the number with the left most number in the sequence shown above, the second right mo...
apps_data_3201
Write a regex to validate a 24 hours time string. See examples to figure out what you should check for: Accepted: 01:00 - 1:00 Not accepted: 24:00 You should check for correct length and no spaces. import re _24H = re.compile(r'^([01]?\d|2[0-3]):[0-5]\d$') validate_time = lambda time: bool(_24H.match(time)) ...
apps_data_3202
# Personalized greeting Create a function that gives a personalized greeting. This function takes two parameters: `name` and `owner`. Use conditionals to return the proper message: case | return --- | --- name equals owner | 'Hello boss' otherwise | 'Hello guest' def greet(name, owner): return "Hello bo...
apps_data_3203
Implement `String#parse_mana_cost`, which parses [Magic: the Gathering mana costs](http://mtgsalvation.gamepedia.com/Mana_cost) expressed as a string and returns a `Hash` with keys being kinds of mana, and values being the numbers. Don't include any mana types equal to zero. Format is: * optionally natural number re...
apps_data_3204
# Let's play Psychic A box contains green, red, and blue balls. The total number of balls is given by `n` (`0 < n < 50`). Each ball has a mass that depends on the ball color. Green balls weigh `5kg`, red balls weigh `4kg`, and blue balls weigh `3kg`. Given the total number of balls in the box, `n`, and a total mass...
apps_data_3205
Create a function that checks if a number `n` is divisible by two numbers `x` **AND** `y`. All inputs are positive, non-zero digits. ```JS Examples: 1) n = 3, x = 1, y = 3 => true because 3 is divisible by 1 and 3 2) n = 12, x = 2, y = 6 => true because 12 is divisible by 2 and 6 3) n = 100, x = 5, y = 3 => fa...
apps_data_3206
Write a function that takes as its parameters *one or more numbers which are the diameters of circles.* The function should return the *total area of all the circles*, rounded to the nearest integer in a string that says "We have this much circle: xyz". You don't know how many circles you will be given, but you can...
apps_data_3207
Complete the solution so that it reverses all of the words within the string passed in. Example: ```python reverseWords("The greatest victory is that which requires no battle") // should return "battle no requires which that is victory greatest The" ``` def reverseWords(str): return " ".join(str.split(" ")[::-1...
apps_data_3208
There is a queue for the self-checkout tills at the supermarket. Your task is write a function to calculate the total time required for all the customers to check out! ### input ```if-not:c * customers: an array of positive integers representing the queue. Each integer represents a customer, and its value is the amoun...
apps_data_3209
# Problem In China,there is an ancient mathematical book, called "The Mathematical Classic of Sun Zi"(《孙子算经》). In the book, there is a classic math problem: “今有物不知其数,三三数之剩二,五五数之剩三,七七数之剩二,问物几何?” Ahh, Sorry. I forgot that you don't know Chinese. Let's translate it to English: There is a unkown positive integer `n`. W...
apps_data_3210
You receive the name of a city as a string, and you need to return a string that shows how many times each letter shows up in the string by using an asterisk (`*`). For example: ``` "Chicago" --> "c:**,h:*,i:*,a:*,g:*,o:*" ``` As you can see, the letter `c` is shown only once, but with 2 asterisks. The return str...
apps_data_3211
# It's too hot, and they can't even… One hot summer day Pete and his friend Billy decided to buy watermelons. They chose the biggest crate. They rushed home, dying of thirst, and decided to divide their loot, however they faced a hard problem. Pete and Billy are great fans of even numbers, that's why they want to div...
apps_data_3212
The marketing team is spending way too much time typing in hashtags. Let's help them with our own Hashtag Generator! Here's the deal: - It must start with a hashtag (`#`). - All words must have their first letter capitalized. - If the final result is longer than 140 chars it must return `false`. - If the input or ...
apps_data_3213
Beaches are filled with sand, water, fish, and sun. Given a string, calculate how many times the words `"Sand"`, `"Water"`, `"Fish"`, and `"Sun"` appear without overlapping (regardless of the case). ## Examples ```python sum_of_a_beach("WAtErSlIde") ==> 1 sum_of_a_beach("GolDeNSanDyWateRyBeaChSuNN...
apps_data_3214
Create a function which accepts one arbitrary string as an argument, and return a string of length 26. The objective is to set each of the 26 characters of the output string to either `'1'` or `'0'` based on the fact whether the Nth letter of the alphabet is present in the input (independent of its case). So if an `'...
apps_data_3215
## Number pyramid Number pyramid is a recursive structure where each next row is constructed by adding adjacent values of the current row. For example: ``` Row 1 [1 2 3 4] Row 2 [3 5 7] Row 3 [8 12] Row 4 [20] ``` ___ ## Task Given the first row of the number...
apps_data_3216
My friend John likes to go to the cinema. He can choose between system A and system B. ``` System A : he buys a ticket (15 dollars) every time System B : he buys a card (500 dollars) and a first ticket for 0.90 times the ticket price, then for each additional ticket he pays 0.90 times the price paid for the previous t...
apps_data_3217
You will have a list of rationals in the form ``` lst = [ [numer_1, denom_1] , ... , [numer_n, denom_n] ] ``` or ``` lst = [ (numer_1, denom_1) , ... , (numer_n, denom_n) ] ``` where all numbers are positive integers. You have to produce their sum `N / D` in an irreducible form: this means that `N` and `D` have only ...
apps_data_3218
Scheduling is how the processor decides which jobs(processes) get to use the processor and for how long. This can cause a lot of problems. Like a really long process taking the entire CPU and freezing all the other processes. One solution is Shortest Job First(SJF), which today you will be implementing. SJF works by, ...
apps_data_3219
We are interested in collecting the sets of six prime numbers, that having a starting prime p, the following values are also primes forming the sextuplet ```[p, p + 4, p + 6, p + 10, p + 12, p + 16]``` The first sextuplet that we find is ```[7, 11, 13, 17, 19, 23]``` The second one is ```[97, 101, 103, 107, 109, 113]...
apps_data_3220
The sum of divisors of `6` is `12` and the sum of divisors of `28` is `56`. You will notice that `12/6 = 2` and `56/28 = 2`. We shall say that `(6,28)` is a pair with a ratio of `2`. Similarly, `(30,140)` is also a pair but with a ratio of `2.4`. These ratios are simply decimal representations of fractions. `(6,28)` ...
apps_data_3221
Given an array of integers, find the one that appears an odd number of times. There will always be only one integer that appears an odd number of times. def find_it(seq): for i in seq: if seq.count(i)%2!=0: return i def find_it(seq): counts = dict() for n in seq: if n not in c...
apps_data_3222
Given two integers `a` and `b`, which can be positive or negative, find the sum of all the numbers between including them too and return it. If the two numbers are equal return `a` or `b`. **Note:** `a` and `b` are not ordered! ## Examples ```python get_sum(1, 0) == 1 // 1 + 0 = 1 get_sum(1, 2) == 3 // 1 + 2 = 3...
apps_data_3223
The first positive integer, `n`, with its value `4n² + 1`, being divisible by `5` and `13` is `4`. (condition 1) It can be demonstrated that we have infinite numbers that may satisfy the above condition. If we name **ai**, the different terms of the sequence of numbers with this property, we define `S(n)` as: We a...
apps_data_3224
Given two numbers (m and n) : - convert all numbers from m to n to binary - sum them as if they were in base 10 - convert the result to binary - return as string Eg: with the numbers 1 and 4 1 // 1 to binary is 1 + 10 // 2 to binary is 10 + 11 // 3 to binary is 11 +100 // 4 to binary is 100 ---- 122 // 122 in ...
apps_data_3225
Given an array (a list in Python) of integers and an integer `n`, find all occurrences of `n` in the given array and return another array containing all the index positions of `n` in the given array. If `n` is not in the given array, return an empty array `[]`. Assume that `n` and all values in the given array will a...
apps_data_3226
Task: Given an array arr of strings complete the function landPerimeter by calculating the total perimeter of all the islands. Each piece of land will be marked with 'X' while the water fields are represented as 'O'. Consider each tile being a perfect 1 x 1piece of land. Some examples for better visualization: ['XOOXO...
apps_data_3227
### Task Yes, your eyes are no problem, this is toLoverCase (), not toLowerCase (), we want to make the world full of love. ### What do we need to do? You need to add a prototype function to the String, the name is toLoverCase. Function can convert the letters in the string, converted to "L", "O", "V", "E", ...
apps_data_3228
Write ```python word_pattern(pattern, string) ``` that given a ```pattern``` and a string ```str```, find if ```str``` follows the same sequence as ```pattern```. For example: ```python word_pattern('abab', 'truck car truck car') == True word_pattern('aaaa', 'dog dog dog dog') == True word_pattern('abab', 'apple bana...
apps_data_3229
Wilson primes satisfy the following condition. Let ```P``` represent a prime number. Then ```((P-1)! + 1) / (P * P)``` should give a whole number. Your task is to create a function that returns ```true``` if the given number is a Wilson prime. def am_i_wilson(n): return n in (5, 13, 563) def am_i_wilson(n): ...
apps_data_3230
You're a programmer in a SEO company. The SEO specialist of your company gets the list of all project keywords everyday, then he looks for the longest keys to analyze them. You will get the list with keywords and must write a simple function that returns the biggest search keywords and sorts them in lexicographical or...
apps_data_3231
# Task Given an initial string `s`, switch case of the minimal possible number of letters to make the whole string written in the upper case or in the lower case. # Input/Output `[input]` string `s` String of odd length consisting of English letters. 3 ≤ inputString.length ≤ 99. `[output]` a string The resulting...
apps_data_3232
As part of this Kata, you need to find the length of the sequence in an array, between the first and the second occurrence of a specified number. For example, for a given array `arr` [0, -3, 7, 4, 0, 3, 7, 9] Finding length between two `7`s like lengthOfSequence([0, -3, 7, 4, 0, 3, 7, 9], 7) wo...
apps_data_3233
# Task We have a N×N `matrix` (N<10) and a robot. We wrote in each point of matrix x and y coordinates of a point of matrix. When robot goes to a point of matrix, reads x and y and transfer to point with x and y coordinates. For each point in the matrix we want to know if robot returns back to it after `EXA...
apps_data_3234
You will be given a certain array of length ```n```, such that ```n > 4```, having positive and negative integers but there will be no zeroes and all the elements will occur once in it. We may obtain an amount of ```n``` sub-arrays of length ```n - 1```, removing one element at a time (from left to right). For each ...
apps_data_3235
In genetics a reading frame is a way to divide a sequence of nucleotides (DNA bases) into a set of consecutive non-overlapping triplets (also called codon). Each of this triplets is translated into an amino-acid during a translation process to create proteins. Input --- In a single strand of DNA you find 3 Reading fra...
apps_data_3236
## MTV Cribs is back! ![](https://s-media-cache-ak0.pinimg.com/236x/1b/cf/f4/1bcff4f4621644461103576e40bde4ed.jpg) _If you haven't solved it already I recommend trying [this kata](https://www.codewars.com/kata/5834a44e44ff289b5a000075) first._ ## Task Given `n` representing the number of floors build a penthouse li...
apps_data_3237
```if-not:sql Create a function (or write a script in Shell) that takes an integer as an argument and returns "Even" for even numbers or "Odd" for odd numbers. ``` ```if:sql ## SQL Notes: You will be given a table, `numbers`, with one column `number`. Return a table with a column `is_even` containing "Even" or "Odd" ...
apps_data_3238
Hey CodeWarrior, we've got a lot to code today! I hope you know the basic string manipulation methods, because this kata will be all about them. Here we go... ## Background We've got a very long string, containing a bunch of User IDs. This string is a listing, which seperates each user ID with a comma and a whites...
apps_data_3239
# Task Four men, `a, b, c and d` are standing in a line, one behind another. There's a wall between the first three people (a, b and c) and the last one (d). a, b and c are lined up in order of height, so that person a can see the backs of b and c, person b can see the back of c, and c can see just the wall. ...
apps_data_3240
Normally, we decompose a number into binary digits by assigning it with powers of 2, with a coefficient of `0` or `1` for each term: `25 = 1*16 + 1*8 + 0*4 + 0*2 + 1*1` The choice of `0` and `1` is... not very binary. We shall perform the *true* binary expansion by expanding with powers of 2, but with a coefficient o...
apps_data_3241
# Task A newspaper is published in Walrusland. Its heading is `s1` , it consists of lowercase Latin letters. Fangy the little walrus wants to buy several such newspapers, cut out their headings, glue them one to another in order to get one big string. After that walrus erase several letters from this string in orde...
apps_data_3242
# Task Given an integer array `arr`. Your task is to remove one element, maximize the product of elements. The result is the element which should be removed. If more than one valid results exist, return the smallest one. # Input/Output `[input]` integer array `arr` non-empty unsorted integer array. It contains p...
apps_data_3243
It's been a tough week at work and you are stuggling to get out of bed in the morning. While waiting at the bus stop you realise that if you could time your arrival to the nearest minute you could get valuable extra minutes in bed. There is a bus that goes to your office every 15 minute, the first bus is at `06:00`, ...
apps_data_3244
You and your best friend Stripes have just landed your first high school jobs! You'll be delivering newspapers to your neighbourhood on weekends. For your services you'll be charging a set price depending on the quantity of the newspaper bundles. The cost of deliveries is: - $3.85 for 40 newspapers - $1.93 for 20 - $...
apps_data_3245
You know combinations: for example, if you take 5 cards from a 52 cards deck you have 2,598,960 different combinations. In mathematics the number of x combinations you can take from a set of n elements is called the binomial coefficient of n and x, or more often `n choose x`. The formula to compute `m = n choose x` i...
apps_data_3246
Goal Given a list of elements [a1, a2, ..., an], with each ai being a string, write a function **majority** that returns the value that appears the most in the list. If there's no winner, the function should return None, NULL, nil, etc, based on the programming language. Example majority(["A", "B", "A"]) returns "A"...
apps_data_3247
# Task Some people are standing in a row in a park. There are trees between them which cannot be moved. Your task is to rearrange the people by their heights in a non-descending order without moving the trees. # Example For `a = [-1, 150, 190, 170, -1, -1, 160, 180]`, the output should be `[-1, 150, 160, 170,...
apps_data_3248
In music, if you double (or halve) the pitch of any note you will get to the same note again. "Concert A" is fixed at 440 Hz, and every other note is defined based on that. 880 Hz is also an A, as is 1760 Hz, as is 220 Hz. There are 12 notes in Western music: A, A#, B, C, C#, D, D#, E, F, F#, G, G#. You are given a p...
apps_data_3249
#### Background: A linear regression line has an equation in the form `$Y = a + bX$`, where `$X$` is the explanatory variable and `$Y$` is the dependent variable. The parameter `$b$` represents the *slope* of the line, while `$a$` is called the *intercept* (the value of `$y$` when `$x = 0$`). For more details visi...
apps_data_3250
Bob is a theoretical coder - he doesn't write code, but comes up with theories, formulas and algorithm ideas. You are his secretary, and he has tasked you with writing the code for his newest project - a method for making the short form of a word. Write a function ```shortForm```(C# ```ShortForm```, Python ```short_for...
apps_data_3251
Given a positive number n > 1 find the prime factor decomposition of n. The result will be a string with the following form : ``` "(p1**n1)(p2**n2)...(pk**nk)" ``` where ```a ** b``` means ```a``` to the power of ```b``` with the p(i) in increasing order and n(i) empty if n(i) is 1. ``` Example: n = 86240 should retu...
apps_data_3252
Complete the code which should return `true` if the given object is a single ASCII letter (lower or upper case), `false` otherwise. def is_letter(s): return len(s) == 1 and s.isalpha() import re def is_letter(stg): return bool(re.match(r"[a-z]\Z", stg, re.I)) import re def is_letter(s): return bool(re.f...
apps_data_3253
As you may know, once some people pass their teens, they jokingly only celebrate their 20th or 21st birthday, forever. With some maths skills, that's totally possible - you only need to select the correct number base! For example, if they turn 32, that's exactly 20 - in base 16... Already 39? That's just 21, in base 1...
apps_data_3254
~~~if-not:ruby,python Return `1` when *any* odd bit of `x` equals 1; `0` otherwise. ~~~ ~~~if:ruby,python Return `true` when *any* odd bit of `x` equals 1; `false` otherwise. ~~~ Assume that: * `x` is an unsigned, 32-bit integer; * the bits are zero-indexed (the least significant bit is position 0) ## Examples ``` ...
apps_data_3255
Given a string, remove any characters that are unique from the string. Example: input: "abccdefee" output: "cceee" from collections import Counter def only_duplicates(string): cs = Counter(string) return ''.join(c for c in string if cs[c] > 1) def only_duplicates(string): return "".join([x for x in s...
apps_data_3256
Let's take an integer number, ``` start``` and let's do the iterative process described below: - we take its digits and raise each of them to a certain power, ```n```, and add all those values up. (result = ```r1```) - we repeat the same process with the value ```r1``` and so on, ```k``` times. Let's do it with ```s...
apps_data_3257
**This Kata is intended as a small challenge for my students** All Star Code Challenge #19 You work for an ad agency and your boss, Bob, loves a catchy slogan. He's always jumbling together "buzz" words until he gets one he likes. You're looking to impress Boss Bob with a function that can do his job for him. Create...
apps_data_3258
You are to write a function to transpose a guitar tab up or down a number of semitones. The amount to transpose is a number, positive or negative. The tab is given as an array, with six elements for each guitar string (fittingly passed as strings). Output your tab in a similar form. Guitar tablature (or 'tab') is an a...
apps_data_3259
# Background My TV remote control has arrow buttons and an `OK` button. I can use these to move a "cursor" on a logical screen keyboard to type words... # Keyboard The screen "keyboard" layout looks like this #tvkb { width : 400px; border: 5px solid gray; border-collapse: collapse; } #tvkb td { ...
apps_data_3260
A function receives a certain numbers of integers ```n1, n2, n3 ..., np```(all positive and different from 0) and a factor ```k, k > 0``` The function rearranges the numbers ```n1, n2, ..., np``` in such order that generates the minimum number concatenating the digits and this number should be divisible by ```k```. T...
apps_data_3261
>When no more interesting kata can be resolved, I just choose to create the new kata, to solve their own, to enjoy the process --myjinxin2015 said # Description: John learns to play poker with his uncle. His uncle told him: Poker to be in accordance with the order of "2 3 4 5 6 7 8 9 10 J Q K A". The same suit sho...
apps_data_3262
## Task Create a function that given a sequence of strings, groups the elements that can be obtained by rotating others, ignoring upper or lower cases. In the event that an element appears more than once in the input sequence, only one of them will be taken into account for the result, discarding the rest. ## Inpu...
apps_data_3263
In this Kata, you will be given a series of times at which an alarm goes off. Your task will be to determine the maximum time interval between alarms. Each alarm starts ringing at the beginning of the corresponding minute and rings for exactly one minute. The times in the array are not in chronological order. Ignore du...
apps_data_3264
In this Kata, you will implement a function `count` that takes an integer and returns the number of digits in `factorial(n)`. For example, `count(5) = 3`, because `5! = 120`, and `120` has `3` digits. More examples in the test cases. Brute force is not possible. A little research will go a long way, as this is a...
apps_data_3265
See the following triangle: ``` ____________________________________ 1 2 4 2 3 6 9 6 3 4 8 12 16 12 8 4 5 10 15 20 25 20 15 10 5 ___________________________________ ``` The tot...
apps_data_3266
# Fix the Bugs (Syntax) - My First Kata ## Overview Hello, this is my first Kata so forgive me if it is of poor quality. In this Kata you should fix/create a program that ```return```s the following values: - ```false/False``` if either a or b (or both) are not numbers - ```a % b``` plus ```b % a``` if both argum...
apps_data_3267
For every good kata idea there seem to be quite a few bad ones! In this kata you need to check the provided array (x) for good ideas 'good' and bad ideas 'bad'. If there are one or two good ideas, return 'Publish!', if there are more than 2 return 'I smell a series!'. If there are no good ideas, as is often the case, ...
apps_data_3268
You're given a string containing a sequence of words separated with whitespaces. Let's say it is a sequence of patterns: a name and a corresponding number - like this: ```"red 1 yellow 2 black 3 white 4"``` You want to turn it into a different **string** of objects you plan to work with later on - like this: ```"[{n...
apps_data_3269
You are the best freelancer in the city. Everybody knows you, but what they don't know, is that you are actually offloading your work to other freelancers and and you rarely need to do any work. You're living the life! To make this process easier you need to write a method called workNeeded to figure out how much time...
apps_data_3270
The pair of integer numbers `(m, n)`, such that `10 > m > n > 0`, (below 10), that its sum, `(m + n)`, and rest, `(m - n)`, are perfect squares, is (5, 4). Let's see what we have explained with numbers. ``` 5 + 4 = 9 = 3² 5 - 4 = 1 = 1² (10 > 5 > 4 > 0) ``` The pair of numbers `(m, n)`, closest to and below 50, havi...
apps_data_3271
We want an array, but not just any old array, an array with contents! Write a function that produces an array with the numbers `0` to `N-1` in it. For example, the following code will result in an array containing the numbers `0` to `4`: ``` arr(5) // => [0,1,2,3,4] ``` def arr(n=0): return list(range(n)) def...
apps_data_3272
## Find Mean Find the mean (average) of a list of numbers in an array. ## Information To find the mean (average) of a set of numbers add all of the numbers together and divide by the number of values in the list. For an example list of `1, 3, 5, 7` 1. Add all of the numbers ``` 1+3+5+7 = 16 ``` 2. Divide by the ...
apps_data_3273
In this Kata, two players, Alice and Bob, are playing a palindrome game. Alice starts with `string1`, Bob starts with `string2`, and the board starts out as an empty string. Alice and Bob take turns; during a turn, a player selects a letter from his or her string, removes it from the string, and appends it to the board...
apps_data_3274
In this Kata, you will be given a string and your task will be to return the length of the longest prefix that is also a suffix. A prefix is the start of a string while the suffix is the end of a string. For instance, the prefixes of the string `"abcd"` are `["a","ab","abc"]`. The suffixes are `["bcd", "cd", "d"]`. Yo...
apps_data_3275
*It seemed a good idea at the time...* # Why I did it? After a year on **Codewars** I really needed a holiday... But not wanting to drift backwards in the honour rankings while I was away, I hatched a cunning plan! # The Cunning Plan So I borrowed my friend's "Clone Machine" and cloned myself :-) Now my clone can...
apps_data_3276
Jenny is 9 years old. She is the youngest detective in North America. Jenny is a 3rd grader student, so when a new mission comes up, she gets a code to decipher in a form of a sticker (with numbers) in her math notebook and a comment (a sentence) in her writing notebook. All she needs to do is to figure out one word, f...
apps_data_3277
You have to create a function which receives 3 arguments: 2 numbers, and the result of an unknown operation performed on them (also a number). Based on those 3 values you have to return a string, that describes which operation was used to get the given result. The possible return strings are: `"addition"`, `"subt...
apps_data_3278
Given a string that includes alphanumeric characters ('3a4B2d') return the expansion of that string: The numeric values represent the occurrence of each letter preceding that numeric value. There should be no numeric characters in the final string. Empty strings should return an empty string. The first occurrence of...
apps_data_3279
Once upon a time, a CodeWarrior, after reading a [discussion on what can be the plural](http://www.codewars.com/kata/plural/discuss/javascript), took a look at [this page](http://en.wikipedia.org/wiki/Grammatical_number#Types_of_number ) and discovered that **more than 1** "kind of plural" may exist. For example [Sur...
apps_data_3280
Write a function, which takes a non-negative integer (seconds) as input and returns the time in a human-readable format (`HH:MM:SS`) * `HH` = hours, padded to 2 digits, range: 00 - 99 * `MM` = minutes, padded to 2 digits, range: 00 - 59 * `SS` = seconds, padded to 2 digits, range: 00 - 59 The maximum time never excee...
apps_data_3281
_Friday 13th or Black Friday is considered as unlucky day. Calculate how many unlucky days are in the given year._ Find the number of Friday 13th in the given year. __Input:__ Year as an integer. __Output:__ Number of Black Fridays in the year as an integer. __Examples:__ unluckyDays(2015) == 3 unl...
apps_data_3282
Lot of museum allow you to be a member, for a certain amount `amount_by_year` you can have unlimitted acces to the museum. In this kata you should complete a function in order to know after how many visit it will be better to take an annual pass. The function take 2 arguments `annual_price` and `individual_price`. f...
apps_data_3283
Your aged grandfather is tragically optimistic about Team GB's chances in the upcoming World Cup, and has enlisted you to help him make [Union Jack](https://en.wikipedia.org/wiki/Union_Jack) flags to decorate his house with. ## Instructions * Write a function which takes as a parameter a number which represents the d...
apps_data_3284
Each floating-point number should be formatted that only the first two decimal places are returned. You don't need to check whether the input is a valid number because only valid numbers are used in the tests. Don't round the numbers! Just cut them after two decimal places! ``` Right examples: 32.8493 is 32.84 1...
apps_data_3285
We all love the future president (or Führer or duce or sōtō as he could find them more fitting) donald trump, but we might fear that some of his many fans like John Miller or John Barron are not making him justice, sounding too much like their (and our as well, of course!) hero and thus risking to compromise him. For ...
apps_data_3286
### The Story: Bob is working as a bus driver. However, he has become extremely popular amongst the city's residents. With so many passengers wanting to get aboard his bus, he sometimes has to face the problem of not enough space left on the bus! He wants you to write a simple program telling him if he will be able to ...
apps_data_3287
The wide mouth frog is particularly interested in the eating habits of other creatures. He just can't stop asking the creatures he encounters what they like to eat. But then he meet the alligator who just LOVES to eat wide-mouthed frogs! When he meets the alligator, it then makes a tiny mouth. Your goal in this kata...
apps_data_3288
In this Kata, you will be given a number in form of a string and an integer `k` and your task is to insert `k` commas into the string and determine which of the partitions is the largest. ``` For example: solve('1234',1) = 234 because ('1','234') or ('12','34') or ('123','4'). solve('1234',2) = 34 because ('1','2','3...
apps_data_3289
In genetics, a sequence’s motif is a nucleotides (or amino-acid) sequence pattern. Sequence motifs have a biological significance. For more information you can take a look [here](https://en.wikipedia.org/wiki/Sequence_motif). For this kata you need to complete the function `motif_locator`. This function receives 2 ar...
apps_data_3290
Create a function that takes in the sum and age difference of two people, calculates their individual ages, and returns a pair of values (oldest age first) if those exist or `null/None` if: * `sum < 0` * `difference < 0` * Either of the calculated ages come out to be negative def get_ages(a,b): x = (a+b)/2 y ...
apps_data_3291
Generate and return **all** possible increasing arithmetic progressions of six primes `[a, b, c, d, e, f]` between the given limits. Note: the upper and lower limits are inclusive. An arithmetic progression is a sequence where the difference between consecutive numbers is the same, such as: 2, 4, 6, 8. A prime number...
apps_data_3292
Given a string, turn each letter into its ASCII character code and join them together to create a number - let's call this number `total1`: ``` 'ABC' --> 'A' = 65, 'B' = 66, 'C' = 67 --> 656667 ``` Then replace any incidence of the number `7` with the number `1`, and call this number 'total2': ``` total1 = 656667 ...
apps_data_3293
Rule 30 is a one-dimensional binary cellular automaton. You can have some information here: * [https://en.wikipedia.org/wiki/Rule_30](https://en.wikipedia.org/wiki/Rule_30) You have to write a function that takes as input an array of 0 and 1 and a positive integer that represents the number of iterations. This func...
apps_data_3294
Sometimes, I want to quickly be able to convert miles per imperial gallon into kilometers per liter. Create an application that will display the number of kilometers per liter (output) based on the number of miles per imperial gallon (input). Make sure to round off the result to two decimal points. If the answer ends...
apps_data_3295
The aim of this kata is to split a given string into different strings of equal size (note size of strings is passed to the method) Example: Split the below string into other strings of size #3 'supercalifragilisticexpialidocious' Will return a new string 'sup erc ali fra gil ist ice xpi ali doc iou...
apps_data_3296
Return the century of the input year. The input will always be a 4 digit string, so there is no need for validation. ### Examples ``` "1999" --> "20th" "2011" --> "21st" "2154" --> "22nd" "2259" --> "23rd" "1124" --> "12th" "2000" --> "20th" ``` def what_century(year): n = (int(year) - 1) // 100 + 1 return s...
apps_data_3297
A stick is balanced horizontally on a support. Will it topple over or stay balanced? (This is a physics problem: imagine a real wooden stick balanced horizontally on someone's finger or on a narrow table, for example). The stick is represented as a list, where each entry shows the mass in that part of the stick. The...
apps_data_3298
# ASC Week 1 Challenge 5 (Medium #2) Create a function that takes a 2D array as an input, and outputs another array that contains the average values for the numbers in the nested arrays at the corresponding indexes. Note: the function should also work with negative numbers and floats. ## Examples ``` [ [1, 2, 3, 4]...
apps_data_3299
# Task John won the championship of a TV show. He can get some bonuses. He needs to play a game to determine the amount of his bonus. Here are some cards in a row. A number is written on each card. In each turn, John can take a card, but only from the beginning or the end of the row. Then multiply the number on the...