Fizz-Buzz is a group word game for children to teach them about division. Players take turns to count incrementally, replacing any multiple of three with the word “fizz”, and any multiple of five with the word “buzz”.
For this challenge you need to write a computer program that will display all the numbers between 1 and 100.
- For each number divisible by three the computer will display the word “fizz”,
- For each number divisible by five the computer will display the word “buzz”,
- For each number divisible by three and by five the computer will display the word “fizz-buzz”,
This is what the output will look like:
Check the following flowchart used to generate the first 100 numbers using the Fizz-Buzz rules. (Click on the flowchart to enlarge it).
Use the above flowchart to complete this Python code.
Extension Task #1
Tweak this code to use the input command in Python. The program should ask the user to input numbers in order or type the word Fizz or Buzz when required. The program should check that the user has typed the right number or the right word and stop if not. It should then give the final score (How far the player completed the game).
Extension Task #2
Improve this code further to give the players three lives. The player can make up to 3 mistakes. Each time they make a mistake they lose 10 points but carry on playing till they lose their three lives.