Array1 = [ "hello", "hey", "hi" ]
Get = input("Enter something: ")
if Get == Array1:
print("Hey, How may I help you")
else:
print("hmm hmm")
Here, if the user enters, "Hello I am XYZ", then it works as expected, but if the input is, "Hello, I am XYZ", it doesn't identify the Array elements. That (,) comma creates the problem. Like it isn't understanding that "Hello..." and "Hello, ..." are the same
Aucun commentaire:
Enregistrer un commentaire