Last active
March 16, 2016 13:43
-
-
Save mscandizzo/5f802175e1472f14e427 to your computer and use it in GitHub Desktop.
FizzBuzz updated
This file contains hidden or 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
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