Files
live-campus-mcs-p-2027.2/Semaine_04/Bibliotheque/main.py
2026-01-14 10:21:12 +01:00

36 lines
936 B
Python

from functions import \
add_new_book,\
take_out_book,\
list_books_in_list,\
sort_books_by_name,\
display_number_of_books,\
search_book_by_word,\
search_book_by_letter,\
save, load
books = []
for i in range(3):
new_book_title = input ("Quel livre ajouter ? > ")
new_book_author = input ("Qui l'a écrit ? > ")
new_book = {
"Title": new_book_title,
"Author": new_book_author
}
new_book_added = add_new_book(books, new_book)
print (new_book_added)
#print(take_out_book(books, new_book))
sort_books_by_name(books)
print(list_books_in_list(books))
book_number = display_number_of_books(books)
print(f"La bibliothèque contient {book_number} livres.")
searching_word = input("Mot recherché > ")
print(search_book_by_word(books, searching_word))
searching_letter = input("Lettre recherchée > ")
print(search_book_by_letter(books, searching_letter))