Skip to content

Instantly share code, notes, and snippets.

@mscandizzo
Last active March 16, 2016 13:43
Show Gist options
  • Save mscandizzo/5f802175e1472f14e427 to your computer and use it in GitHub Desktop.
Save mscandizzo/5f802175e1472f14e427 to your computer and use it in GitHub Desktop.
FizzBuzz updated
lists = []
while True:
try:
val = int(raw_input("Please enter range upper boundary:"))
break
except:
print "I guess you did not enter a number, please try again"
continue
for n in range(1,val):
if n % 3 == 0 and n % 5 == 0:
lists.append("FizzBuzz")
elif n % 3 == 0:
lists.append("Fizz")
elif n % 5 == 0:
lists.append("Buzz")
else:
lists.append(n)
for elem in lists:
print elem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment