Motivation
Learning a programming language can be challenging. Although there are tons of articles and tutorials for learning languages the most important thing is to transfer your knowledge to other real world problems.
The challenges
The coding challenges are language agnostic so you can use any modern language which supports writing command line applications.
- Write the famous / infamous Hello World
- Write a script that prints all numbers between 1 and 365 to the console
- Write a script that prints 10 random numbers between 1 and 10
- Write a script that prints all letters from the alphabet (upper case) with their respective position in the alphabet e.g. 1: a, 2: b
- Write your first unit test for a function is_even(num) which returns true if value is even
- Write a function which returns a list of prime numbers below a given number by using the Sieve of Eratosthenes
- Have the function first_reverse(input) take the input parameter being passed and return the string in reversed order.
- For example: if the input string is “Hello World and Coders” then your program should return the string “sredoC dna dlroW olleH”.
- Have the function compare(num1, num2) take both parameters being passed and
- return –1 if num1 is less than num2,
- otherwise return 1.
- If the parameter values are equal to each other then return 0.
- Have the function alphabet_soup(input) take the input string parameter being passed and return the string with the letters in alphabetical order (ie. hello becomes ehllo).
- Assume numbers and punctuation symbols will not be included in the string.
- Have the function simple_adding(num) add up all the numbers from 1 to num.
- For example: if the input is 4 then your program should return 10 because 1 + 2 + 3 + 4 = 10.
- For the test cases, the parameter num will be any number from 1 to 1000.
- Have the function time_convert(minutes) take the minutes parameter being passed and return the number of hours and minutes the parameter converts to (ie. if minutes= 63 then the output should be 1:03). Separate the number of hours and minutes with a colon.
- Have the function factorial(num) take the num parameter being passed and return the factorial of it.
- For example: if num = 4, then your program should return (4 * 3 * 2 * 1) = 24.
- For the test cases, the range will be between 1 and 18 and the input will always be an integer.
- Have the function longest_word(sentence) take the sentence parameter being passed and return the largest word in the string.
- If there are two or more words that are the same length, return the first word from the string with that length.
- Ignore punctuation and assume sentence will not be empty.
- Sample Input “fun&!! time”, “I love dogs”
- Have the function letter_changes(input) take the input parameter being passed and modify it using the following algorithm.
- Replace every letter in the string with the letter following it in the alphabet (ie. c becomes d, z becomes a).
- Then capitalize every vowel in this new string (a, e, i, o, u) and finally return this modified string.
- Have the function kaprekars_constant(num) take the num parameter being passed which will be a 4-digit number with at least two distinct digits.
- Your program should perform the following routine on the number:
- Arrange the digits in descending order and in ascending order (adding zeroes to fit it to a 4-digit number)
- subtract the smaller number from the bigger number.
- Then repeat the previous step.Performing this routine will always cause you to reach a fixed number: 6174.
- then performing the routine on 6174 will always give you 6174 (7641 – 1467 = 6174).
- Your program should return the number of times this routine must be performed until 6174 is reached.
- For example: if num is 3524 your program should return 3 because of the following steps: (1) 5432 – 2345 = 3087, (2) 8730 – 0378 = 8352, (3) 8532 – 2358 = 6174.
- Write a function which calculates mean, median of a given integer array
- Write a function which sorts an integer array with bubblesort
- Write a function which calculates the greatest common divisor using euclids method (assert 2 == greatest_common_divisor(18, 20))






