Instructions
-
Create a repository on your GitHub account.
-
Write down the solution in a file
-
Push the solution to the above repository once done.
-
Submit the repository link for review.
-
Ensure your repository has a well-written README, detailing the steps taken to break down the problem and come up with a solution (Read me Sample.)
Challenge 1: No ifs no buts(Toy Problem) Write a function that accepts two numbers a and b and returns whether a is smaller than, bigger than, or equal to b, as a string.
Example:
(5, 4) ---> "5 is greater than 4"
(-4, -7) ---> "-4 is greater than -7"
(2, 2) ---> "2 is equal to 2" There is only one problem...
You cannot use if statements, and you cannot use the ternary operator ?
In fact, the word if and the character ? are not allowed in your code.
Challenge2: Ordered Count of Characters(Toy Problem) Count the number of occurrences of each character and return it as a (list of arrays) in order of appearance. For empty output return (an empty list).
Example:
"abracadabra" ----> [['a', 5], ['b', 2], ['r', 2], ['c', 1], ['d', 1]]
"Code Wars -----> [['C', 1], ['o', 1], ['d', 1], ['e', 1], [' ', 1], ['W', 1], ['a', 1], ['r', 1], ['s', 1]]
"233312", ------> [['2', 2], ['3', 3], ['1', 1 ]]