Advertisement
xah

Training Problem Y - Fizz Buzz

xah
Mar 24th, 2017 (edited)
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. legend = []
  2. sample = int(input())
  3.  
  4. while sample:
  5.     if sample == 0:
  6.         break
  7.  
  8.     elif sample % 3 == 0:
  9.         note = 'Fizz'
  10.         if sample % 5 == 0:
  11.             note = 'Fizz Buzz'
  12.         legend.append(note)
  13.  
  14.     elif sample % 5 == 0:
  15.         legend.append('Buzz')
  16.  
  17.     else:
  18.         legend.append(sample)
  19.  
  20.     sample = int(input())
  21.  
  22. for l in legend:
  23.     print(l)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement