With that said, enjoy!
Embedded Compiler Version
Plain Text Version
Complete the function that receives as input a string, and produces outputs according to the following table:
|“School Counselor”||“Anything with Alcohol”|
|“Programmer”||“Hipster Craft Beer”|
|“Bike Gang Member”||“Moonshine”|
|“Politician”||“Your tax dollars”|
Note: anything else is the default case: if the input to the function is not any of the values in the table, then the return value should be “Beer”.
Make sure you cover the cases where certain words do not show up with correct capitalization. For example, the input “pOLitiCIaN” should still return “Your tax dollars”
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”.
“abcdefghijklm” –> [“b”, “d”, “f”, “h”, “j”, “l”]
“a” –> “invalid string”
The company you work for has just been awarded a contract to build a payment gateway. In order to help move things along, you have volunteered to create a function that will take a float and return (IN STRING FORMAT) the amount formatting in dollars and cents.
39.99 becomes $39.99
The rest of your team will make sure that the argument is sanitized before being passed to your function although you will need to account for adding trailing zeros if they are missing (though you won’t have to worry about a dangling period).
3 needs to become $3.00
3.1 needs to become $3.10
Good luck! Your team knows they can count on you!
In this Kata, you will be given two strings a and b and your task will be to return the characters that are not common in the two strings.
solve(“xyab”,”xzca”) = “ybzc”
–The first string has ‘yb’ which is not in the second string.
–The second string has ‘zc’ which is not in the first string.
Notice also that you return the characters from the first string concatenated with those from the second string.
More examples in the tests cases.
Complete the solution so that it reverses the string passed into it.
‘world’ => ‘dlrow’
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 asterisks (*).
“Chicago” –> “c:**,h:*,i:*,a:*,g:*,o:*”
As you can see, the letter c is shown only once, but with 2 asterisks.
The return string should include only the letters (not the dashes, spaces, apostrophes, etc). There should be no spaces in the output, and the different letters are separated by a comma (,) as seen in the example above.
Note that the return string must list the letters in order of their first appearance in the original string.
“Bangkok” –> “b:*,a:*,n:*,g:*,k:**,o:*”
“Las Vegas” –> “l:*,a:**,s:**,v:*,e:*,g:*”
Have fun! 😉
Complete the solution so that it reverses all of the words within the string passed in.
reverseWords(“The greatest victory is that which requires no battle”)
// should return “battle no requires which that is victory greatest The”
Return the number (count) of vowels in the given string.
We will consider a, e, i, o, u as vowels for this Kata (but not y).
The input string will only consist of lower case letters and/or spaces.
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 are always valid strings.
Given a string, return true if the first instance of “x” in the string is immediately followed by the string “xx”.
tripleX(“abraxxxas”) → true
tripleX(“xoxotrololololololoxxx”) → false
tripleX(“softX kitty, warm kitty, xxxxx”) → true
tripleX(“softx kitty, warm kitty, xxxxx”) → false
- capital X’s do not count as an occurrence of “x”.
- if there are no “x”‘s then return false