Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple Passwords
#10
(Sep-22-2019, 01:19 AM)ichabod801 Wrote: Because x in thisdict checks against the keys of the dictionary (1, 2, and 3). You would have to check x 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!")
Reply


Messages In This Thread
Multiple Passwords - by NotPythonQueen - Sep-21-2019, 06:38 PM
RE: Multiple Passwords - by buran - Sep-21-2019, 06:41 PM
RE: Multiple Passwords - by NotPythonQueen - Sep-21-2019, 06:47 PM
RE: Multiple Passwords - by buran - Sep-21-2019, 06:51 PM
RE: Multiple Passwords - by NotPythonQueen - Sep-21-2019, 06:57 PM
RE: Multiple Passwords - by buran - Sep-21-2019, 07:37 PM
RE: Multiple Passwords - by ichabod801 - Sep-21-2019, 09:27 PM
RE: Multiple Passwords - by NotPythonQueen - Sep-22-2019, 12:44 AM
RE: Multiple Passwords - by ichabod801 - Sep-22-2019, 01:19 AM
RE: Multiple Passwords - by NotPythonQueen - Sep-22-2019, 01:31 AM
RE: Multiple Passwords - by ichabod801 - Sep-22-2019, 01:57 AM
RE: Multiple Passwords - by NotPythonQueen - Sep-22-2019, 03:13 AM
RE: Multiple Passwords - by perfringo - Sep-22-2019, 04:15 AM
RE: Multiple Passwords - by NotPythonQueen - Sep-22-2019, 04:54 AM
RE: Multiple Passwords - by perfringo - Sep-22-2019, 06:05 AM
RE: Multiple Passwords - by buran - Sep-22-2019, 06:17 AM
RE: Multiple Passwords - by jefsummers - Sep-22-2019, 12:18 PM
RE: Multiple Passwords - by gbs - Sep-22-2019, 06:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Hashing Passwords (HELP) MianDoesCoding 4 2,256 May-26-2020, 03:11 PM
Last Post: buran
  Writing incorrect passwords to a file till its correct garth 2 5,010 Feb-10-2017, 11:41 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020