Doubt regarding a snippet of code

I’m not able to drag and drop images on Chrome for Mac, so, I’ll share the snippet of code.

users = {“Harry”: “Password”,
“Mark”: “Code”}

def login(username,password):

if username in users and users[username] == password:

print(“Hello World”)

else:

print(“Not Authenticated”)

Could you please help me with the line:

if username in users and users[username] == password ?

I don’t understand how ‘username’ connects to the dictionary ‘users’.
Is the function argument ‘username’ used as a key from the dictionary which equates to the argument ‘password’?

Hello @alankarms99_82ff291312452614,
In this program you created dictionary users wherein the key is your username corresponding to it the value is the password for that username. Now you create a function login in which you pass the username and password.
if username in users and users[username] == password ? This line of code checks whether the password entered by the corresponding username is as we inserted in dictionary users.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.