first commit
This commit is contained in:
16
functions/get_set_Book.py
Normal file
16
functions/get_set_Book.py
Normal file
@@ -0,0 +1,16 @@
|
||||
def get_Books(book_list):
|
||||
print("Available books:")
|
||||
print("Book_ID: ", "Book_Name")
|
||||
for book in book_list:
|
||||
print(f"{book['id']}: {book['name']}")
|
||||
|
||||
def set_Book(book_list):
|
||||
while True:
|
||||
try:
|
||||
book_to_backup = int(input("Enter the book ID to backup: "))
|
||||
if any(book['id'] == book_to_backup for book in book_list):
|
||||
return book_to_backup
|
||||
else:
|
||||
print("Invalid book ID, please try again.")
|
||||
except ValueError:
|
||||
print("Please enter a valid number.")
|
||||
Reference in New Issue
Block a user