-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrary.py
More file actions
88 lines (57 loc) · 1.8 KB
/
Copy pathlibrary.py
File metadata and controls
88 lines (57 loc) · 1.8 KB
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
81
82
83
84
85
86
87
88
def main_menu():
print("WELCOME TO LIBRARY")
print("What would you like to do?")
option=int(input("1. New user \n 2. Existing user "))
# choosing algo:
if option == 1:
new_user()
if option == 2:
old_user()
else:
print("please choose a correct value")
main_menu()
#new user manager:
def new_user():
print("New user\n")
a=(input("Username: "))
uupath="C:/CHANDU/n00b/Librarymanager/useruname.txt"
with open(uupath,"r") as reader:
reading=reader.read()
for i in reading:
if a in i:
print("username already exists!\n")
main_menu()
b=(input("Password: "))
b2=input("re-enteryour Password: ")
if b != b2:
print("Passwords do not match.\n")
new_user()
# uppath="C:/CHANDU/n00b/Librarymanager/userpass.txt"
with open("useruname.txt","a") as useruname:
useruname.write(a+"\n")
with open("userpass.txt","a") as userpass:
userpass.write(b + "\n")
print("user created!")
main_menu()
# old user manager:
def old_user():
print("Old User\n")
a=input("Username: ")
uupath="C:/CHANDU/n00b/Librarymanager/useruname.txt"
with open(uupath,"r") as reader_a:
reading_a=reader_a.read()
if a not in reading_a:
print("User does not exist!")
old_user()
b=input("Password: ")
uppath="C:/CHANDU/n00b/Librarymanager/userpass.txt"
with open(uppath,"r") as reader_b:
reading_b=reader_b.read()
if b not in reading_b:
print("Password entered is wrong!")
old_user()
library_UI()
def library_UI():
print("at libriary UI")
exit()
main_menu()