Skip to content

Instantly share code, notes, and snippets.

@Ralphbaer
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ralphbaer/89d589525028e851486b to your computer and use it in GitHub Desktop.
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:
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