Exemple #1
0
            result = book1.deducting_inventory(qty)
        elif choice == 2:
            qty = int(input("How many would you like to remove?"))
            result = book2.deducting_inventory(qty)
            if result == 0:
                print("The quantity is now 1" + ' ' + str(book1.quantity) +
                      "\n\n")
            else:
                print("You do not have enough to remove from inventory!")

    elif menu_choice == 3:
        print("Book 1 or 2?")
        choice = int(input())
        if choice == 1:
            price = float(input("What would you like the new price to be?"))
            book1.price = price
            print("The price has been changed to" + ' ' + str(book1.price) +
                  "\n\n")
        elif choice == 2:
            price = float(input("What would you like the new price to be?"))
            book2.price = price
            print("The price has been changed to" + ' ' + str(book2.price) +
                  "\n\n")

    elif menu_choice == 4:
        print("Book 1 or 2?")
        choice = int(input())
        if choice == 1:
            year = int(
                input(
                    "What year would you like to change it to, can be past or future."
Exemple #2
0
            menu_choice = int(input("> "))

            if menu_choice == 1:
                print("You chose to add inventory")
                addition = input("How many books did we add: ")
                textbook_1.add_inventory(addition)
                print(textbook_1.quantity_in_inventory)
            elif menu_choice == 2:
                print("You chose to decrease inventory")
                lose = input("How many books did we sell: ")
                textbook_1.decrease_inventory(lose)
                print(textbook_1.quantity_in_inventory)
            elif menu_choice == 3:
                print("You chose to change the price")
                print(f"The current price is: ${textbook_1.price}")
                textbook_1.price = float(input("The price is now: $"))
            elif menu_choice == 4:
                print("You chose to leave this book as it is.")
            else:
                print("Invalid choice")
    elif book_choice == 2:
        while menu_choice != 4:
            print("Please chose the number to indicate which option you would like to choose")
            print("1. Add inventory")
            print("2. Decrease inventory")
            print("3. Change price")
            print("4. Leave everything how it is")

            menu_choice = int(input("> "))

            if menu_choice == 1: