Oct-15-2018, 05:18 AM
Hi everyone,i am new to this forum.I need help in my code.i wrote a program for user login and get user details.
I created dic for users and assign gmail id and password as it values.
when we enter the user that not in dict it should create new key and store it
i my program the dict (Users) is not updated every time when i enter new user. please help me on my mistake
here is my code
import turtle
global check_user
users={
"Ram":['[email protected]','111-281-1920'],
"mira":['[email protected]','150-170-1213']
}
check_user=input("Enter name")
for u_keys,u_values in users.items():
if check_user in u_keys:
print(u_values)
else:
print("No user with the name {}" .format(check_user))
break
print("would u like to create an account")
for i in range(2):
x=input("Say yes or NO : ")
if x == "yes":
print("Enter details")
id=input("enter mail id")
phone_no=input("enter phone number")
users.update({check_user:[id,phone_no]})
break
else:
print("thanks for shopping")
break
print(users)
I created dic for users and assign gmail id and password as it values.
when we enter the user that not in dict it should create new key and store it
i my program the dict (Users) is not updated every time when i enter new user. please help me on my mistake
here is my code
import turtle
global check_user
users={
"Ram":['[email protected]','111-281-1920'],
"mira":['[email protected]','150-170-1213']
}
check_user=input("Enter name")
for u_keys,u_values in users.items():
if check_user in u_keys:
print(u_values)
else:
print("No user with the name {}" .format(check_user))
break
print("would u like to create an account")
for i in range(2):
x=input("Say yes or NO : ")
if x == "yes":
print("Enter details")
id=input("enter mail id")
phone_no=input("enter phone number")
users.update({check_user:[id,phone_no]})
break
else:
print("thanks for shopping")
break
print(users)