def list_books(): try: books = database.get_all_books() except FileNotFoundError: database.create_book_table() books = database.get_all_books() for book in books: read = "YES" if book['read'] else "NO" print(f"{book['name']} by {book['author']}, read: {read}")
def list_books(): books = database.get_all_books() for book in books: read = 'YES' if book['read'] else 'NO' print( f"{book['name'].capitalize()} by {book['author'].capitalize()}, read {read}" )
def list_books(): """[list all the books available in the database] """ books = database.get_all_books() for book in books: read = 'YES' if book['read'] else 'NO' print(f"{book['name']} by {book['author']},read:{read}")
def list_books(): # ALl books are shown here books = database.get_all_books() # This get all the books from DB for book in books: # yes will come if book == true else no read = "Yes" if book["read"] else "No" # printing books list by fstring print(f"Book {book['name']} By Author {book['author']} is read {read}")
def list_books(): books = database.get_all_books() for book in books: name = book['name'] author = book['author'] read = 1 if book['read'] else 0 print(f"- {name} by {author}. read: {read}.")
def list_books(): # for book in db.books: # print(f"Title : {book['name']}\nAuthor: {book['author']}") books = db.get_all_books() for book in books: read = 'Yes' if book['read'] else 'No' print(f"{book['name']} by {book['author']}, read : {read}")
def list_books(): books = database.get_all_books() print('\n====== All Books =====') for book in books: read = green('YES') if book['read'] else red('NO') print( f"{magenta(book['name'])} by {blue(book['author'])}, read: {read}") print('======================\n')
def list_book(): books = database.get_all_books() if not books: # if the file is empty print(f'No books stored') else: for book in books: read = 'YES' if book['read'] else 'NO' print(f"{book['name']} by {book['author']}, read: {read}")
def list_books(): """ List the books from the database using the print_book_list function. """ books = database.get_all_books() print_book_list(books)
def list_books(): """List all books in the database.""" books = database.get_all_books() for number, book in enumerate(books, 1): read = 'yes' if book['read'] else 'no' print( f"{[number]} - {book['name']} by {book['author']} — Read: {read}")
def prompt_get_all_books(): books = database.get_all_books() if books == []: print("\nYour list is empty!") for book in books: read = 'YES' if book['read'] else 'NO' print(f"{book['name']} by {book['author']}, read: {read}")
def list_books(): books = database.get_all_books() if len(books) == 0: print("No books, feel free to add some :-)") return for book_id, book in enumerate(books): print_book(book_id, book)
def look_after_name_or_author(expected, finder): found = [] books = database.get_all_books() for book in books: if finder(book) == expected: found.append(book) return found
def list_books(): # Print out all books in a nice format library = database.get_all_books() print(f'You have {len(library)} book(s) in your library.') for book in library: book_title = book['title'] book_author = book['author'] book_read = "Yes" if book['read'] == "1" else "No" print(f'{book_title}, by {book_author}, read: {book_read}')
def list_books(): """ Show all the book in our list :return: """ books = database.get_all_books() print('List of books:') for book in books: read = 'YES' if book['read'] == 1 else 'NO' print(f"{ book['name'] } by { book['author'] }, read: { read }")
def menu(): database.create_book_table() user_input = input(USER_CHOICE) while user_input != "q": if user_input == "a": name = input("Enter book name:") author = input("Enter book author:") database.a(name, author) elif user_input == "r": user_input = input("What title are you reading?: ") database.r(user_input) elif user_input == "l": books = database.get_all_books() for book in books: database.l(book) elif user_input == "d": user_input = input("What title would like to delete: ") database.d(user_input) elif user_input == "q": break else: print("Unknown command. Please try again!") user_input = input(USER_CHOICE)
def list_books(): books = database.get_all_books() for i, book in enumerate(books): print(f'B{i + 1}\n Namn: {book["name"]}\n Author: {book["author"]}\n Read: {"Yes" if book["read"] else "Nope"}\n')
def list_books(): books = database.get_all_books() for book in books: read = 'YES YOU READ THIS BOOK' if book[ 'read'] == 'True' else "YOU HAVEN'T READ THE BOOK YET" print(f"{book['name']} by author {book['author']},read:{read}")
def list_books(): for book in database.get_all_books(): read = 'YES' if book[ 'read'] else 'NO' # book[3] will be a falsy value (0) if not read print(f"{book['name']} by {book['author']} — Read: {read}")
def list_books(): books = database.get_all_books() for book in books: read = 'Yes' if book['read'] == '1' else 'No' print(f"{book['name']} by {book['author']} - Read: {read}")
def list_books(): books = database.get_all_books() for book in books: read = 'YES' if book['read'] == 1 else 'NO' print(f"{book['name']} escrito por {book['name']} leido: {read}")
def list_books(): books = database.get_all_books() for n in books: Read = 'YES' if n['read'] else 'NO' print(f'Name: {n["name"]}, Author: {n["author"]}, Read: {Read}')
def list_books(): books = database.get_all_books() for book in books: read = 'YES' if book['read'] else 'NO' #python reads a 1 integer as True, a 0 integer as False print(f"{book['name']} by {book['author']}, read: {read}")
def list_books(): for book in database.get_all_books(): read = 'YES' if book[ 3] else 'NO' # book[3] will be a falsy value (0) if not read print(f'{book[1]} by {book[2]} — Read: {read}')
def list_books(): books = database.get_all_books() for i, book in enumerate(books): read = 'YES' if book['read'] else 'NO' print(f"{str(i + 1).zfill(2)} - {book['name']} by {book['author']}, read: {read}")
def list_book(): books = database.get_all_books() for book in books: read = 'YES' if book['read'] == "1" else "NO" print(f"{book['name']} by {book['author']}, read: {read}")
def list_books(): books = database.get_all_books() for book in books: read = 'YES' if book['read'] == 1 else 'NO' print(f"{book['name']} by {book['author']} is read : {read}")
def list_books(): books = database.get_all_books() for book in books: read = 'YES' if book['read'] else 'NO' print('{} by {} , read: {}'.format(book['name'],book['author'],book['read']))
def list_books(): for book in database.get_all_books(): read = 'YES' if book['read'] else 'NO' print(f"{book['name']} by {book['author']} — Read: {read}")
def list_books(): books = db.get_all_books() for book in books: read = 'YES' if book['read'] else 'NO' print(f"{book['name']} by {book['author']}, read: {read}")