def prompt_add_book(): name = input("Enter the new book name: ") author = input("Enter the new book author: ") try: database.add_book(name, author) except Exception as e: print(e)
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 prompt_add_book(): """ Get the name and the other of the book by input and add it to the database """ name = input('Enter the new book name: ') author = input("Enter the new book author: ") database.add_book(name, author)
def prompt_add_book(): """ Ask for book name and author :return: """ name = input('Enter the book name: ') author = input('Enter the author: ') database.add_book(name, author)
def menu(): user_input = input(USER_CHOICE).lower() while user_input!='q': if user_input=='a': add_book() elif user_input=='d': delete() elif user_input=='l': list_book() if user_input=='r': read_book() user_input = input(USER_CHOICE).lower()
def menu(): database.create_book_table() user_input = input(USER_CHOICE) while user_input != 'q': if user_input == 'a': name = input("Enter the name of the book: ") author = input("Enter the author of the book: ") database.add_book(name, author) user_input = input(USER_CHOICE) elif user_input == 'l': list_books() user_input = input(USER_CHOICE) elif user_input == 'r': mark_book_as_read() user_input = input(USER_CHOICE) elif user_input == 'd': delete_prompt_book() user_input = input(USER_CHOICE)
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 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_add_book(): name = input("Enter the new book name") author = input("Enter the new book author") database.add_book(name, author)
def prompt_add_book(): title = input('Enter book name :') author = input('Enter author :') db.add_book(title, author) print('Book added')
def add_book_prompt(): name = input("Enter the title of the book: ") author = input("Enter the name of the author: ") database.add_book(name, author)
def prompt_add_book(): name = input("Enter the name of the book:") author = input("Enter the author of the book:") database.add_book(name, author)
def prompt_add(): name = input("Enter name of book: ") author = input("Enter name of author: ") database.add_book(name, author)
def prompt_add_book(): name = input('Enter name of the new book: ') author = input('Enter author of the book: ') database.add_book(name, author)
def add_book(): author, name = get_book_details() db.add_book(name, author) print(f'Added book "{name}" by {author} to the bookshelf.')
def prompt_add_book(): name = input('enter the name of new book') author = input('enter the name of the author of the book') database.add_book(name, author)
def prompt_add_book(): name = input('Enter the new book name: ') author = input('Enter the new book author: ') #Asks the database to save the book database.add_book(name, author)
def prompt_add_book(): name = input('Enter book name : ') author = input('Enter author name : ') database.add_book(name, author)
def prompt_add_book(): name = input('Enter the new book name: ') author = input('Enter the new book author: ') author = ''.join([i for i in author if i.isalpha()]) database.add_book(name, author)
def prompt_add_book(): inputs = input("Enter the name and author of the book").split(',') add_book(inputs[0], inputs[1])
def prompt_add_book(): name = input('Insert the book name: ') author = input('Insert the author name: ') database.add_book(name, author)
def prompt_add_book(): name = input("Enter the book's name: ") author = input("Enter the author's name: ") database.add_book(name, author)
from utils import database 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 prompt_add_book(name, author): database.add_book(name, author)
def prompt_add_book(): name = input('Enter the title of the book: ') author = input('Enter the author: ') database.add_book(name, author)
def prompt_add_book(): book_name = input('Enter a name of a the book: ') book_author = input('Enter author\'s full name: ') db.add_book(book_name, book_author)
def prompt_add_book(): book_name = input("Book Name: ") book_author = input("Book Author: ") database.add_book(book_name, book_author)
def prompt_add_book(): name_input = input('What is the name of the Book you would like to add?') author_input = input("What is the name of the Author of the Book?") database.add_book(name_input, author_input)
def prompt_add_book(): name = input('Enter the new book name: ') author = input('Enter the new book author: ') database.add_book(name, author)
def prompt_add_book(): name = input('Introduzca el nombre : ') author = input('Introduzca el autor : ') database.add_book(name, author)