Sep-22-2019, 01:31 AM
(Sep-22-2019, 01:19 AM)ichabod801 Wrote: Becausex in thisdict
checks against the keys of the dictionary (1, 2, and 3). You would have to checkx in thisdict.values()
. Note that checking against the keys is very fast in Python, but checking against the values is probably a bit slower than using a list.
okay i will use it like this, but it still didn't work
thisdict = { "sport": "football", "drink": "sprite", "food": "pizza" } password = input("Please enter a password: ") if password x in thisdict.values() print("Welcome!")