Advertisement
Guest User

Untitled

a guest
May 30th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #define x
  2. x = 0
  3.  
  4. # define for-loop that starts with x and uses the range function to go from 1 to 100
  5. for x in range(1,101):
  6. #Print out "FizzBuzz" if a number in the range is divisible by 3 AND 5
  7. if x%3 == 0 and x%5 == 0:
  8. print("FizzBuzz")
  9.  
  10. #Print out "Fizz" if a number in the range is divisible by 3
  11. elif x%3 == 0:
  12. print("Fizz")
  13.  
  14. #Print out "Buzz" if a number in the range is divisible by 5
  15. elif x%5 == 0:
  16. print("Buzz")
  17.  
  18. #Print out every other number in the range as the number itself
  19. else:
  20. print(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement