0

I am making a fizzbuzz game [see code below] I wanted to add a condition to the if statement that would loop the user back to the beginning of the function if they enter anything other than a number but it did not work it gave me a error anyway is there a way I can go about doing that?

def fizzbuzz():
   print(f"\nEnter a number {name}.\n")

   number = int(input('> '))

   if number % 3 == 0:
      print("We got a FIZZ! And I ain't talking about the kid from B2k! You a bad MF!")
   elif number % 5 == 0:
      print("Buzz lightyear to star command. We are in the mist of a BAMF!")
   elif number % 3 == 0 and number % 5 == 0:
      print("FIZZBUZZ!" * 10, " FIZ [*head explodes*] [kid picks up the mic] How's that for Television")
   elif number / number != 1 or number == 0:
      print("Someones a little slow. Try again sweetheart.")
    fizzbuzz()
   else:
      print("Do you kiss your mother with that none Fizzed or buzzed mouth? Shame! Sercurity!")

print("Join us next time for the show where you better bring your fizzbuzz buzz fizz!......Or else.\n\n")

1 Answers1

0

Try using try and except to handle the errors.

Solomon Ucko
  • 5,724
  • 3
  • 24
  • 45