jeudi 18 août 2016

how to define a set of variables so the program responds in any of the items in a list is called, python3

I create a list so if someones inputs any item from the list it will print the same.

lista = ["example", "example2"]
listb = ["exampleb", "example2b"]
choice = input()
if choice == lista[]:
    print("outputa")
elif choice == listb[]:
    print("outputb")

if the user types either example or example2 it will print outputa but if the user types exampleb or example2b it will print outputb. Thanks

Aucun commentaire:

Enregistrer un commentaire