def MediaStore(): mp=float(100) #Variable for max price that can be changed by user in menu menu=True #Variable used in while loop and determines when the loop ends print("Welcome to BestMedia") #Welcome message print("====================") print( ) item0, item1, item2, item3, item4, item5, item6, item7, item8=inventory.initialize() #Gets original item inventory items=[item0, item1, item2, item3, item4, item5, item6, item7, item8] #Puts inventory into list form while menu==True: inventory.display_menu() #Displays starting menu command=int(input("Enter Command: ")) if command==0: #Option 0 closes menu print("Goodbye!") menu=False elif command==1: #Option 1 displays list of items under maximum price print( ) inventory.display(items,mp) elif command==2: #Option 2 displays some information about the inventory print( ) inventory.info(items) elif command==3 or command==4: #Displays all books or all movies print( ) inventory.display2(items,command,mp) elif command==5: #Allows user to search for item based on reference number search=str(input("Enter item reference: ")) inventory.search_item(items,search) inventory.display_item(items,search) elif command==6: #Allows user to delete item in inventory based on reference number del_item=str(input("Enter item reference: ")) inventory.search_index_item(items,del_item) elif command==7: #Allows user to add items to inventory inventory.create_item(items) elif command==8: #Allows user to set maximum price of items to be displayed mp=float(input("Enter maximum price (current=$%s): "%mp)) else: print("Wrong Input!")
'''------------------------------------------------------ Main program starts here ---------------------------------------------------------''' print("Welcome to BestMedia") print("====================") all_items = inventory.initialize() while True: inventory.display_menu() command = input("Enter Command:\n") if command == "0": print("Goodbye!") break if command == "1": inventory.display(all_items) continue if command == "2": inventory.info(all_items) continue if command == "3": inventory.display(all_items, "Book") continue if command == "4": inventory.display(all_items, "Movie") continue if command == "5": target_ref = input("Enter item reference:\n") inventory.search_item(all_items, target_ref) continue if command == "6":
def main(): """ This is the main method, I call it main by convention. Its an eternal loop, until q is pressed. It should check the choice done by the user and call a appropriate function. """ while True: marvin.menu() choice = input("--> ") userChoice = choice.lower() userChoice = userChoice.split() if len(userChoice) == 1 and userChoice[0] == "inv": inventory.display() elif userChoice[0] == "inv" and userChoice[1] == "pick": if len(userChoice) < 3: print("Dalek says: What do you want me to pick up? Repeat the\ c ommand like this: \"inv pick item\"") else: inventory.pickItem(userChoice[2]) elif userChoice[0] == "inv" and userChoice[1] == "drop": if len(userChoice) == 2: inventory.drop() elif len(userChoice) < 3: print("Dalek says: What do you want me to drop up? Repeat the\ command like this: \"inv drop item\"") else: inventory.dropItem(userChoice[2]) elif "citat" in userChoice: marvin.randomQuote() elif choice == "q": print("Dalek says: Farewell, Doctor.") return elif choice == "1": marvin.myNameIs() elif choice == "2": marvin.ageInSeconds() elif choice == "3": marvin.weightOnMoon() elif choice == "4": marvin.minutesToHours() elif choice == "5": marvin.celciusToFahrenheit() elif choice == "6": marvin.wordMultiplication() elif choice == "7": marvin.randomNumberGenerator() elif choice == "8": marvin.sumOfNumbers() elif choice == "9": marvin.gradesCalculator() elif choice == "10": marvin.guessTheNumber() elif choice == "11": marvin.diary() elif choice == "12": marvin.shuffleWords() else: print("Dalek says: I'm afraid I do not recognize that command,\ Doctor. You must choose a valid option from the menu.") input("\nPress enter to continue...\n")
maxPrice=100.0 media_list=inventory.initialize() print("Welcome to BestMedia\n====================\n") while True: inventory.display_menu() choice=str(input("Enter Command: ")) if choice == '0': break elif choice =='1': print("\nReference/Media/Title/Price (max=$"+str(maxPrice)+")\n---------------------------") inventory.display(media_list,"choice_1",maxPrice) elif choice =='2': inventory.info(media_list) elif choice =='3': print("\nReference/Media/Title/Price (max=$"+str(maxPrice)+")\n---------------------------") inventory.display(media_list,"choice_3",maxPrice) elif choice =='4': print("\nReference/Media/Title/Price (max=$"+str(maxPrice)+")\n---------------------------") inventory.display(media_list,"choice_4",maxPrice) elif choice =='5': inventory.display_item()