Skip to content

Instantly share code, notes, and snippets.

@imranrbx
Forked from hahalim/fizzbuzz.py
Created December 26, 2018 08:02
Show Gist options
  • Save imranrbx/ebc9ab2f89f08e3871dbdaaa63d9a487 to your computer and use it in GitHub Desktop.
Save imranrbx/ebc9ab2f89f08e3871dbdaaa63d9a487 to your computer and use it in GitHub Desktop.
FIZZBUZZ Solution
chance = ""
while (chance!="no"):
try:
num = int(input("Please enter a number\n"))
if (num%5==0 and num%3==0):
print("FizzBuzz")
elif (num%5 == 0):
print("BUZZ")
elif (num%3 == 0):
print("FIZZ");
else:
print("number you entered was "+ str(num))
chance = input("Press any key to continue and type no to quit yes/no\n")
except ValueError:
print("Please enter a valid number")
chance = input("Press any key to continue and type no to quit yes/no\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment