-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibrary system.py
More file actions
52 lines (45 loc) · 1.32 KB
/
Library system.py
File metadata and controls
52 lines (45 loc) · 1.32 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
class Library:
dict = {"Sapiens": "library", "RdPd": "library", "random": "library"}
@classmethod
def display(cls):
print("Here is the list of books")
for n in Library.dict.keys():
print(n)
@classmethod
def add(cls):
m = input("Enter book name.")
n = "library"
Library.dict[m] = n
print("Book added successfully")
@classmethod
def lend(cls):
m = input("Enter book name which you want to lend.")
n = input("Enter the person name who want book.")
if Library.dict.get(m):
Library.dict[m] = n
else:
print("Book does not exists in our library")
print("Book lent successfully")
@classmethod
def return_book(cls):
Library.add()
print("Book returned successfully")
def run():
while (5):
x = int(input("Enter\n 1 to add book\n 2 to display books\n 3 to lend book\n 4 to return book\n 0 to quit"))
if x == 1:
Library.add()
elif x == 2:
Library.display()
elif x == 3:
Library.lend()
elif x == 4:
Library.return_book()
elif x == 0:
quit()
else:
print("enter the correct input from the given list")
run()
def main():
run()
main()