Created
October 22, 2018 20:41
-
-
Save tdesire/0a24cecbcc474fdfc06d3ef49f785f6a 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) == 2: | |
try: | |
n = int(sys.argv[1]) | |
print("Fizz buzz counting up to {}".format(n)) | |
while count <= n: | |
if count % 15 == 0: | |
print('Fizzbuzz') | |
elif count % 3 == 0: | |
print('Fizz') | |
elif count % 5 == 0: | |
print('Buzz') | |
else: | |
print(count) | |
count += 1 | |
except ValueError: | |
print('You must enter a valid integer') | |
else: | |
try: | |
n = int(input("Enter a number to count to: ")) | |
n | |
print("Fizz buzz counting up to {}".format(n)) | |
while count <= n: | |
if count % 15 == 0: | |
print('Fizzbuzz') | |
elif count % 3 == 0: | |
print('Fizz') | |
elif count % 5 == 0: | |
print('Buzz') | |
else: | |
print(count) | |
count += 1 | |
except ValueError: | |
print('You must enter a valid integer') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment