Created
August 25, 2015 01:55
-
-
Save estebanafonso/23e2469ff48b3e20527d to your computer and use it in GitHub Desktop.
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
import sys | |
if len(sys.argv) == 1: | |
input_val = raw_input("Please enter upper limit:") | |
elif len(sys.argv) > 1: | |
input_val = sys.argv[1] | |
try: | |
n = int(input_val) | |
except ValueError: | |
print "Please supply a numerical input." | |
n = int(raw_input("Please enter upper limit:")) | |
print "Fizz buzz counting up to " + str(n) | |
i = 1 | |
while (i<=n): | |
if i % 3 == 0 and i % 5 == 0: | |
print "fizz buzz" | |
elif i % 3 == 0: | |
print "fizz" | |
elif i % 5 == 0: | |
print "buzz" | |
else: | |
print i | |
i +=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment