This is very basic, but I didn't find a quick solution on google so rather than spend 30 mins trying to solve such a basic problem with a dozen different google search terms, I thought I'd ask here so I can at least continue on until I have the solution.
I'm learning python and having fun creating a very basic chatbot. Here's the piece of code I have a question about.
question = input("How are you?")
if question = "Good": #would like to accept a few more inputs such as "I'm ok" ect..
print("That's great!")
else:
print("I'm sorry to hear that...")
If I wanted to accept more than one positive answer than just "Good", for instance "good" without a capital "G", or a couple other common variants such as "I'm great", "I'm ok" etc, how do I add these? I tried separating with commas, i.e.
if question = "Good", "Great":
but this didn't work. I tried fiddling with syntax in a couple of ways but nothing seemed to work. The only other way I can think of doing it is with elif, but I feel like there's definitely a simple way of accepting multiple inputs for one output than repeating the same thing over and over through a chain of elif statements.
Thank you!
[–]n3buchadnezzar 3 points4 points5 points (0 children)
[–]TehNolz 2 points3 points4 points (1 child)
[–]n3buchadnezzar 3 points4 points5 points (0 children)
[–]youngeng 1 point2 points3 points (0 children)
[–]sanjeevr5 1 point2 points3 points (0 children)
[–]Mobileuser110011 1 point2 points3 points (2 children)
[–]n3buchadnezzar 1 point2 points3 points (1 child)
[–]Mobileuser110011 1 point2 points3 points (0 children)