Kilometres to miles converter
Write a function that takes kilometres as a parameter ,converts it into miles and returns the result
Divisible by 11 checker
Write a function that takes an integer as an argument and returns whether it is divisible by 11 or not.
Write a function that takes 2 numbers as arguments and returns the highest of the 2 numbers.
Hexagon area calculator
Write a function that takes the length of a side of a regular hexagon as a parameter and returns the area of the hexagon.
Days til Christmas
Write a function that calculates how many days it is until Christmas and returns the number of days.
You may want to use the Datetime module to help you.
Is a palindrome?
Create a function that checks to see if a given string is a palindrome or not.
You might want to take a look at the String methods video for some help.
Fuel cost calculator
Write a function that takes a distance as a required argument, mpg (default 50 mpg) and fuel costs (default $1 a litre) as optional arguments. The function should return the cost in dollars.
Most common character
Create a function that takes a string as a parameter and the returns the most common character in that string.
Is a prime number?
Write a function that takes an integer and checks if it is a prime number or not, returning a Boolean.
All Prime numbers
Write a function that takes an integer value as an argument and returns a list of all prime numbers up to that number.
Hint: You might want to use modulo
Highest Common Factor
Write a function that takes 2 integer values and returns the highest common factor of the numbers.
Write a function that takes a date in string format DD/MM/YYYY and checks to see if it is a valid date and in the correct format.
Your function should take account of leap years.
You may want to look at the date conversion video for help.
Write a function that takes a post code as an argument and returns whether it is a valid post code.
[2 letters] [1 or 2 Digits] [Space] [1 Digit] [2 letters]
(This is a slight simplification from the real UK postcode system to make the challenge a little easier – otherwise you would need to use a pretty complicate regular expression)
Hint: You might want to use on or more of the follow:
Check Valid Email Address
Write a function that takes an email address as an argument and returns True/False depending on whether it is a valid email address.
- Must contain at least 1 character before the at symbol
- Must contain an @ symbol
- Must have at-least 1 character after the @ symbol and before the period(.)
- Must contain at least 1 character after the last period(.).
- Maximum 256 characters
- Must start with a letter or a number
Caesar Cipher Encryptor / Decryptor
Create a function that takes some text(String) and a Shift(Integer)and then encrypts the text using the Caesar Cipher algorithm, returning the encrypted text.
Create a second function to decrypt an encrypted string, using the same input parameters and returning the decrypted text.
Find all palindromes
Create a function that is given a string and returns a list of all the palindromes in the string.