Further Exercises

Further Exercises#

(Click here for the German version of this page)

Fizz buzz#

A popular exercise for beginners is the fizz buzz problem:

  • The numbers 1 up to (including) 100 are to be printed, each in their own line.

  • Numbers, which are divisible by 3 are to be replaced with the string Fizz

  • Numbers, which are divisible by 5 are to be replaced with the string Buzz

  • Numbers, which are divisible by both 3 and 5 are to be replaced with the string FizzBuzz

The output should look like this: (Note that the right column is just included for clarity)

Output    (Number)

1         1
2         2
Fizz      3
4         4
Buzz      5
Fizz      6
7         7
8         8
Fizz      9
Buzz      10
11        11
Fizz      12
13        13
14        14
FizzBuzz  15
16        16
...       ...
98        98
Fizz      99
Buzz      100

Your solution#

# Here you can solve the fizz buzz problem...

Palindromes#

A palindrome is a word, which is read the same no matter if one reads from left to right or right to left.

I.e., the word can be mirrored in the middle without change.

Examples: radar, kayak

Word:   R A D A R
Index:  0 1 2 3 4

Word:   R A D A R
Index:  4 3 2 1 0

It does not matter whether you read “RADAR” from left to right or right to left, the result is the same.

Your task is to write a function, which takes a string as input and returns True if the provided string is a palindrome and False if it is not. To reduce complexity, you can assume that only lowercase letters without punctuation or spaces are provided.

# Here you can solve the palindrome problem...