Answer to Question #258452 in Python for Fizz

Question #258452

Let's play a game of FizzBuzz! It works just like the popular childhood game "PopCorn", but with rules of math applied since math is fun, right?


Just print out "Fizz" when the given number is divisible by 3, "Buzz" when it's divisible by 5, and "FizzBuzz" when it's divisible by both 3 and 5!


Let the game begin!


Input

A line containing an integer. It is guaranteed that the input is either divisible by 3, 5, or by both.


15

Output

A line containing a string.


FizzBuzz
1
Expert's answer
2021-10-29T01:49:47-0400
n = int(input())
s = ""
if n % 3 == 0:
    s += "Fizz"
if n % 5 == 0:
    s += "Buzz"
print(s)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog