-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrary management python.py
More file actions
59 lines (50 loc) · 1.56 KB
/
Copy pathlibrary management python.py
File metadata and controls
59 lines (50 loc) · 1.56 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
books = ["Python Basics", "Data Structures", "AI Introduction", "Machine Learning", "Operating Systems"]
borrowed = []
returned = []
while True:
print("\n1. Show Available Books")
print("2. Borrow Book")
print("3. Return Book")
print("4. Show Borrowed Books")
print("5. Show Returned Books")
print("6. Exit")
choice = input("Enter choice: ")
if choice == "1":
if len(books) == 0:
print("No books available")
else:
for b in books:
print(b)
elif choice == "2":
name = input("Enter book name to borrow: ").title()
if name in books:
books.remove(name)
borrowed.append(name)
print("Book borrowed successfully")
else:
print("Book not available")
elif choice == "3":
name = input("Enter book name to return: ").title()
if name in borrowed:
borrowed.remove(name)
books.append(name)
returned.append(name)
print("Book returned successfully")
else:
print("This book was not borrowed")
elif choice == "4":
if len(borrowed) == 0:
print("No borrowed books")
else:
for b in borrowed:
print(b)
elif choice == "5":
if len(returned) == 0:
print("No returned books")
else:
for b in returned:
print(b)
elif choice == "6":
break
else:
print("Invalid choice")