-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmini_Project1.py
161 lines (132 loc) · 4.92 KB
/
mini_Project1.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import datetime
print("**********Enter name of books in block letters**************")
novels=['BRAVE NEW WORLD','DARKNESS AT NOON','INVISIBLE MAN','TO THE LIGHTHOUSE','NATIVE SON']
story_bks=['SHADOW AND BONE','SIX OF CROWS','THE YOUNG ELITES','MASK OF SHADOWS','MY TORIN']
entrance=['H C VERMA','R D SHARMA','D C PANDEY','BIOLOGY','CHEMISTRY 1','CHEMISTRY 2']
name=[]
lend_bks=[]
def add_book():
while True:
print("Which type of book you want to add: ")
print("1. A Novel")
print("2. A Story Book")
print("3. A Book related to Entrance Exam")
print("4. Exit")
a=int(input())
if a==1:
b=input("Enter the name of the book you want to add: ")
novels.append(b)
elif a==2:
b=input("Enter the name of the book you want to add: ")
story_bks.append(b)
elif a==3:
b=input("Enter the name of the book you want to add: ")
entrance.append(b)
elif a==4:
print("****************************************************")
break
else:
print("*****************Enter proper choice*************************")
def display_book():
while True:
print("Which type of book you want to Display: ")
print("1. A Novel")
print("2. A Story Book")
print("3. A Book related to Entrance Exam")
print("4. Exit")
a=int(input())
if a==1:
print("Novels: \n")
for i in novels:
print(i)
print("****************************************************")
elif a==2:
print("Story books: \n")
for i in story_bks:
print(i)
print("****************************************************")
elif a==3:
print("Entrance Books: \n")
for i in entrance:
print(i)
print("****************************************************")
elif a==4:
print("****************************************************")
break
else:
print("*****************Enter proper choice*************************")
def ret_book():
n=input("Enter your name: ")
n.upper()
r=input("Enter the name of book to be returned: ")
r.upper
name.remove(n)
lend_bks.remove(r)
print("Date and Time you returned the book: ",datetime.datetime.now())
print("****************************************************")
def lend_book():
print("Which type of book you want to Display: ")
print("1. A Novel")
print("2. A Story Book")
print("3. A Book related to Entrance Exam")
a=int(input())
if a==1:
n=input("Enter your Name: ")
l=input("Enter name of the book you want to lend: ")
if l not in novels:
print("Book is not available in the library")
elif l not in lend_bks:
lend_bks.append(l)
name.append(n)
print("Date and Time you borrowed the book: ",datetime.datetime.now())
else:
print("Book is used by someone else !!!")
print("****************************************************")
elif a==2:
n=input("Enter your Name: ")
l=input("Enter name of the book you want to lend: ")
if l not in story_bks:
print("Book is not available in the library")
elif l not in lend_bks:
lend_bks.append(l)
name.append(n)
print("Date and Time you borrowed the book: ",datetime.datetime.now())
else:
print("Book is used by someone else !!!")
print("****************************************************")
else:
n=input("Enter your Name: ")
l=input("Enter name of the book you want to lend: ")
if l not in entrance:
print("Book is not available in the library")
elif l not in lend_bks:
lend_bks.append(l)
name.append(n)
print("Date and Time you borrowed the book: ",datetime.datetime.now())
else:
print("Book is used by someone else !!!")
print("****************************************************")
while True:
print("Enter your choice: ")
print("1.Display Books")
print("2.Add Book")
print("3.Lend Book")
print("4.Return Book")
print("5.Exit")
print("-------------------------------------------------------")
a=int(input())
print("-------------------------------------------------------")
if a==1:
display_book()
elif a==2:
add_book()
elif a==3:
lend_book()
elif a==4:
ret_book()
elif a==5:
print("****************************************************")
break
else:
print("Enter proper Choice")
print("****************************************************")