2.12. Exercise: Fizz Buzz 2

You are playing the game known as “Fizz Buzz”. In this game you and your friends count upwards from 1, but everytime the number is a multiple of 3 you say “Fizz” instead. For multiples of 5 you say “Buzz” instead. For multiples of both, you say “Fizz Buzz”.

Write a program that takes an integer n as input, prints the numbers form 1 to n, replacing the numbers with “Fizz”, “Buzz” and “Fizz Buzz” according to the game.

Hint: The sample i/o given below is printed by calling the \(\color{purple}{\texttt{print()}}\) function with the additional argument end as '\t' (e.g. print("Fizz", end='\t')) for the sake of readability.

Sample I/O:

Input:
47

Output:
1    2    Fizz    4    Buzz    Fizz    7    8    Fizz    Buzz    11   Fizz    13    14    FizzBuzz    16    17    Fizz    19    Buzz    Fizz    22    23    Fizz    Buzz    26    Fizz    28    29    FizzBuzz    31    32    Fizz    34    Buzz    Fizz    37    38    Fizz    Buzz    41    Fizz    43    44    FizzBuzz    46    47