-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path17-data_record.py
80 lines (59 loc) · 1.79 KB
/
17-data_record.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
db={}
global email_exit
email_exit=-1
def main_sector():
main_option =int(input("Press 1 to Register:\nPress 2 to Login\nPress 3 Exit:"))
if main_option== 1:
registration()
elif main_option==2:
login()
elif main_option==3:
exit(1)
else:
print("Invalid Option")
main_sector()
def registration():
user_email = input("Enter your email:")
email_get = Email_exit(user_email)
if email_get!=None:
print("Email already exit:")
registration()
else:
user_name = input("Enter your username:")
user_password = input("Enter your password:")
user_phone = int(input("Enter your phone:"))
user_age = int(input("Enter your age:"))
id = len(db)
to_insert = {id: {"email": user_email,"u_name":user_name, "password": user_password,"phone":user_phone,"age":user_age}}
db.update(to_insert)
def login():
user_found=-1;
print("This is login sector")
l_user_email = input("Enter your email to login:")
l_user_password = input("Enter your password to login:")
for i in range(len(db)):
if db[i]["email"] == l_user_email and db[i]["password"]==l_user_password:
user_found=i
if user_found!=-1:
print("Login Success!")
user_profile(user_found)
else:
print("Not Found ")
def user_profile(user_found):
print("Welcome:",db[user_found]["u_name"])
option =int(input("Press 1 to exit"))
if option == 1:
recording_all_data()
def Email_exit(email):
lenght = len(db)
for i in range(lenght):
if db[i]["email"] == email:
return i
def recording_all_data():
pass
def loading_all_data():
pass
if __name__ == '__main__':
loading_all_data()
while True:
main_sector()