Advertisement
furas

Python - FizzBuzzWoof #2

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