How do I obtain the value of a dictionary item in a conditional statement for instance
names = {"one":"john", "two":"justin"}
prompt = input("enter option: ")
if prompt == names["one"]:
print("hey, I am here")
What will you suggest I go about it with a solution similar to line 3 so that I if the user inputs a key for instance "one" it prints "john"
Aucun commentaire:
Enregistrer un commentaire