Last active
August 29, 2015 14:26
-
-
Save Ralphbaer/89d589525028e851486b to your computer and use it in GitHub Desktop.
The problem required "Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. So:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for x in range(1, 101): | |
y = "" | |
if x % 3 == 0: | |
y += "Fizz" | |
if x % 5 == 0: | |
y += "Buzz" | |
if y == "": | |
y = x | |
print y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment