list = ["Donald, Trump", "Joe, Biden", "Barack, Obama"]
while True:
name = input("Name: ")
for short in list:
if name in short[0]:
print("It Work")
else:
print("It Don't Work")
It should print "It Work" since the answers I've provided were in the list but instead it doesn't read the if and instead goes through else, I also have tried removing the else and still does not work
#Output
Name: Donald
It Don't Work
Name: Joe
It Don't Work
Name: Barack
It Don't Work
Name: Donald Trump
It Don't Work
Name:
Aucun commentaire:
Enregistrer un commentaire