Advertisement
nezvers

FizzBuzz_1

Sep 22nd, 2020 (edited)
1,253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. def check(i:int):
  2.     if i == 0:
  3.         return str(i)
  4.     if (abs(i)) % 15 == 0:
  5.         return "fizzbuz"
  6.     if (abs(i)) % 3 == 0:
  7.         return "fizz"
  8.     if (abs(i)) % 5 == 0:
  9.         return "buzz"
  10.     return str(i)
  11.  
  12. def main():
  13.     for i in range(0, 31):
  14.         print(check(i))
  15.  
  16. if __name__ == '__main__':                  #triggered by call from terminal
  17.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement