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 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 which converts system input from lower case to uppercase and prints it
- 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 a function which generates random passwords
- 8 characters in length
- Must contain at least one alphabet lower case
- Must contain at least one alphabet upper case
- Must contain at least one digit
- Must contain at least one special character from !Ӥ$%&/?
- Write your first unit test for the generate password function
- Write 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.
- Have the function simple_symbols(input) take the input parameter being passed.
- Determine if it is an acceptable sequence by either returning the string true or false.
- The input parameter will be composed of + and = symbols with several characters between them (ie. ++d+===+c++==a)
- For the string to be true each letter must be surrounded by a + symbol.
- So the string to the left would be false, because a is not surrounded by + symbols.
- The string will not be empty and will have at least one letter.
- Have the function questions_marks(str) take the str string parameter, which will contain single digit numbers, letters, and question marks.
- Check if there are exactly 3 question marks between every pair of two numbers that add up to 10.
- If so, then your program should return the string true, otherwise it should return the string false.
- If there aren’t any two numbers that add up to 10 in the string, then your program should return false as well.
- For example: if str is “arrb6???4xxbl5???eee5” then your program should return true because there are exactly 3 question marks between 6 and 4, and 3 question marks between 5 and 5 at the end of the string.
- Write a function which calculates mean, median and mode 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))