Created
July 29, 2015 02:04
-
-
Save s-ben/29926bde621bdc58ece1 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: | |
count_to = sys.argv[1] | |
else: | |
count_to = raw_input("how many, yo? ") | |
# Exception handling | |
try: | |
i = int(count_to) | |
print i | |
except (ValueError): | |
#Handle the exception | |
print 'Please enter an integer' | |
count_to = raw_input("how many, yo? ") | |
for num in range(1,int(count_to)): | |
if (num % 3 == 0) and (num % 5 == 0): | |
print 'fizzbuzz' | |
else: | |
if (num % 3 == 0): | |
print 'fizz' | |
elif (num % 5 == 0): | |
print 'buzz' | |
else: | |
print num |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment