Guest User

Untitled

a guest
Oct 23rd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. def fizz_buzz(max_times):
  2. print()
  3. i = 1
  4. while i <= max_times:
  5. if i%15==0:
  6. print("FizzBuzz") if i%10==0 else print("FizzBuzz ", end="")
  7. elif i%3==0:
  8. print("Fizz") if i%10==0 else print("Fizz ", end="")
  9. elif i%5==0:
  10. print("Buzz") if i%10==0 else print("Buzz ", end="")
  11. else:
  12. print(i) if i%10==0 else print(str(i) + " ", end="")
  13. i += 1
  14.  
  15. fizz_buzz(100)
Add Comment
Please, Sign In to add comment