Advertisement
furas

Python - FizzBuzzWoof

Mar 21st, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. def solution(N):
  2.    
  3.     for i in range(1, N+1):
  4.         text = ''
  5.        
  6.         if i%3 == 0:
  7.             text += "Fizz"
  8.            
  9.         if i%5 == 0:
  10.             text += "Buzz"
  11.            
  12.         if i%7 == 0:
  13.             text += "Woof"
  14.            
  15.         if text == '':
  16.             text = i
  17.  
  18.         print(text)
  19.  
  20. # --- tests ---
  21.  
  22. solution(3*5*7)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement