def prompt_delete_book(): """ Ask for book name and delete it to 'Read' in our list :return: """ name = input('Enter the name of the book you wish to delete: ') database.delete_book(name)
def menu(): database.create_book_table() ans = input( '-a for adding a book,\n-r for marking a book as read,\n-l for listing all the books,\n-d for deleting a book and\n-q to quit.' ) while (ans != 'q'): if ans == 'a': name = input('Name of the book: ') author = input('Author of th book: ') database.add(name, author) elif ans == 'r': name = input('Name the book you want to mark as read? ') database.read(name) print('\n The book has been marked as read \n') elif ans == 'l': books = database.all_books() for book in books: if len(books) == 0: print('\n No books to show \n') break print('\nName of the book:', book['name']) print('Author of the book: ', book['author']) print('Has the book been read?', book['read'], '\n') elif ans == 'd': name = input('Name the book you want to delete? ') database.delete_book(name) print('\n The book has been deletd \n') else: print('Enter correctly...') ans = input( '-a for adding a book,\n-r for marking a book as read,\n-l for listing all the books,\n-d for deleting a book and\n-q to quit.' )
def menu(): try: database.books = database.read_from_file('books.txt') database.reload_indexes() except FileNotFoundError: pass while True: user_input = input(f'{USER_CHOICE} \nWhat is your choice?') if user_input == 'a': database.add_book() database.book_index += 1 database.save_to_file('books.txt', database.books) elif user_input == 'l': database.list_books() elif user_input == 'r': database.mark_as_read() database.save_to_file('books.txt', database.books) elif user_input == 'd': database.delete_book() database.save_to_file('books.txt', database.books) elif user_input == 'q': print('Goodbye') break else: print('Invalid option')
def delete_book(): author, name = get_book_details() try: db.delete_book(name, author) except BookNotFoundException as missing: print(missing) else: print(f'Book "{name}" by {author} was deleted.')
def prompt_delete_book(): """ Take the name of the book as input and delete it from the database. """ name = input("Enter then name of the book you would like to delete: ") check_again = input( f"Are you sure you would like to delete {name} book? \n \ Type yes if you really want to delete the book: ") if check_again == 'yes': database.delete_book(name) else: print("The book was not deleted.")
def menu(): database.create_book_table() while True: user_input = input(f'{USER_CHOICE} \nWhat is your choice?') if user_input == 'a': database.add_book() elif user_input == 'l': database.list_books() elif user_input == 'r': database.mark_as_read() elif user_input == 'd': database.delete_book() elif user_input == 'q': print('Goodbye') break else: print('Invalid option')
def menu(): user_input = input(USER_CHOICE) while user_input != 'q': if user_input == 'a': prompt_add_book() elif user_input == 'l': prompt_list_all_books() elif user_input == 'r': prompt_mark_book_as_read elif user_input == 'd': delete_book( input( 'Enter the name of the book from the list which you want to delete' )) else: user_input = input( "Sorry ! You have entered an incorrect book name. Please enter again, enter 'q' to quit" ) user_input = input(USER_CHOICE)
def menu(): global books user_input = input(user_choice) while user_input != 'q': if user_input == 'a': addBooks(books) elif user_input == 'l': list_books(books) elif user_input == 's': search_books(books) elif user_input == 'd': books = delete_book(books) elif user_input == 'r': books = mark_read(books) user_input = input(user_choice)
def main(): # Get the database list data books = database.load_database_list() # Print the screen title print("***********************************") print("* Milestone 2 Project - Databases *") print("***********************************") # Build main menu list main_menu = [ "Add a new book", "List all books", "Mark a book to read", "Delete a book", "Quit" ] while True: # list_menu() ensures that one of the choices has been selected choice = database.list_menu(main_menu, "Main Menu") if choice == 1: database.add_book(books) elif choice == 2: database.list_books(books) elif choice == 3: database.mark_book(books) elif choice == 4: books = database.delete_book(books) else: break # Exit gracefully database.save_database_list(books) # database.create_book_table() raise SystemExit(0)
def prompt_delete_book(): delete_input = input('Which Book would you like to delete?') database.delete_book(delete_input)
def prompt_delete_book(): name = input("What is the name of the book that you've finished: ") database.delete_book(name)
def delete_prompt_book(): name = input("Enter the book that your want do delete: ") database.delete_book(name)
def prompt_delete_book(): book_id = int(input("Book ID:").strip()) book = database.delete_book(book_id) print_book(book_id, book)
def delete_book(): name = input('Delete this book: ') database.delete_book(name)
def delete_books_prompt(): title = input("Enter the title of the book you wish to delete: ") database.delete_book(title)
def prompt_delete_book(): name = input("Enter the name of book u want to delete") database.delete_book(name)
def prompt_delete_book(): print('\n====== Delete Book =====') name = input('Enter the name of the book you wish to delete: ') database.delete_book(name) print('======================\n')
def prompt_delete_book(): """[Asks to the user which book he/she wants to delete] """ name = input("Enter the book's name you wish to delete: \n") database.delete_book(name)
def prompt_delete_book(): name = input('Enter the name of book you want to delete.') database.delete_book(name)
def prompt_delete_book(): name = input('Enter name of book to delete : ') db.delete_book(name)
def delete_book(name): database.delete_book(name)
def prompt_delete_book(): name = input("Enter the name of the book you want to delete: ") database.delete_book(name)
choice = input("""enter a choice a =add a book l=get books from list r=making a book as read d=deleting a book q=quit""") while (choice != 'q'): if (choice == 'a'): name = input("enter book name") author = input("enter author name") database.add_book(name, author) elif (choice == 'l'): l = database.get_books() for i in l: print(i) elif (choice == 'r'): name = input("enter a book name") database.read_book(name) elif (choice == 'd'): nmae = input("enter a book name") database.delete_book(name) else: print("invalid key.press a new key.") choice = input("""enter a choice a =add a book l=get books from list r=making a book as read d=deleting a book q=quit""")
def delete_book_prompt(): name = input("Enter the name of the book you want to delete: ") database.delete_book(name) print(f"{name} successfully deleted")
def prompt_delete_book(): delete_book( input( 'Enter the name of the book from the list which you want to delete' ))
def prompt_delete_book(): name = input('DELETE BOOK!\nBook name: ') database.delete_book(name)
def prompt_delete_book(): book_name = input( "Please enter the name of the book you would like to delete: ") database.delete_book(book_name)
def prompt_delete_book(): book_name = input('Enter a name of the book: ') db.delete_book(book_name)
def prompt_delete_book(): name = input('Enter the name of the book you wish to delete: ') database.delete_book(name)
def prompt_delete_book(): name = input('Enter the name of book you wish to delete:') # author = input('Enter the new book author: ') database.delete_book(name)