0

I am trying to make a game on a the basis of a magic 8 ball game. one of the requirements is to (● If they enter a blank question it asks the user to enter it again) ive looked alot and cannot find anything that i can use that is string based This is what i have so far

    def main():
     cls()
     name = input("What is your name? ")
     question = input("\u001b[33;1mWhat is your question that you desire to answer to? ")
     while question != (""):
      time.sleep(1)
      Generating()
      time.sleep(1)
      print("Ahh yes " + name + " I have a response")
      time.sleep(1)
      randomchoice()

1 Answers1

0

Put the question input into an infinite loop. Exit the loop with a break statement once a non empty response is provided.

def main():
    cls()
    name = input("What is your name? ")
    while True:
        question = input(
            "\u001b[33;1mWhat is your question that you desire to answer to? ")
        if question != "":
            break

    time.sleep(1)
    Generating()
    time.sleep(1)
    print("Ahh yes " + name + " I have a response")
    time.sleep(1)
    randomchoice()
Carl_M
  • 861
  • 1
  • 7
  • 14