Jul-20-2019, 09:34 AM
Hello everybody,
I am working on a little NON AI-Chatbot and I wanted to make a "while True:" loop inside a "if name == "main"". But when I'm running the code, it says:
Here's the nessacery code:
Piethon
I am working on a little NON AI-Chatbot and I wanted to make a "while True:" loop inside a "if name == "main"". But when I'm running the code, it says:
while True: ^ SyntaxError: invalid syntaxI've tried making another script with a while True loop, and that worked, but in the other script it just doesn't work.
Here's the nessacery code:
if __name__ == "__main__" #forever loop while True: #here are some if input things #this is the last piece of code, in the if__name__ ... elif input() in query ["That's not funny at all", "That was not funny", "Not funny."]: jokesorry = ["I am sorry.", "Sorry! :-("] print(random.choice(jokesorry))Yes, so when I run the code, I'm getting a syntax error cause of that while True: as I've menshiond above. But what am I doing wrong about the while True:. Why am I getting an error. Thanks for your help guys. I am using python 3.7.
Piethon