Advertisement
HasteBin0

Python Exhibit of FizzBuzz

Jul 31st, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. # Written by Aidan DiPeri
  4. # Explained by Topm Scott @ https://youtu.be/QPZ0pIK_wsc
  5.  
  6. def play_fizzbuzz(loops: int):
  7.     for i in range(1, loops + 1):
  8.         a, b = (i % 3 == 0), (i % 5 == 0)
  9.         if a: print('Fizz', end='')
  10.         if b: print('Buzz', end='')
  11.         if (not a) and (not b): print(i, end='')
  12.         print()
  13.     return
  14.  
  15. play_fizzbuzz(100)
  16. input()
  17. exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement