Skip to content

Instantly share code, notes, and snippets.

@j10sanders
Last active October 1, 2015 10:33
Show Gist options
  • Save j10sanders/e37a606158351710f692 to your computer and use it in GitHub Desktop.
Save j10sanders/e37a606158351710f692 to your computer and use it in GitHub Desktop.
__author__ = 'Jonathan'
while True:
try:
biggestnum = int(input("How many numbers should we count to? "))
if biggestnum <= 0:
raise ValueError
break
except ValueError:
print("That's not a positive integer.")
except NameError:
print("That's not a positive integer.")
counter = 1
while counter <= biggestnum:
if (counter % 3 == 0) and (counter % 5 == 0):
print("FizzBuzz")
elif counter % 3 == 0:
print("Fizz")
elif counter % 5 == 0:
print("Buzz")
else:
print(counter)
counter += 1
@barraponto
Copy link

See if you can leverage this Python built-in: https://docs.python.org/3/library/stdtypes.html#typesseq-range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment