Dec-17-2021, 03:13 PM
Hello! I have a problem with the code below.
If I remove the 2 lines below from the code, the code enters the loop.
If I leave it when I use option 1 for products and enter the products menu it also shows me the main menu (I marked with ---> the outp that I want to disappear)
If I remove the 2 lines below from the code, the code enters the loop.
If I leave it when I use option 1 for products and enter the products menu it also shows me the main menu (I marked with ---> the outp that I want to disappear)
products = ['product_id', 'name', 'producer','category','price', 'stock'] clients = ['cnp', 'last_name', 'first_name', 'age'] def menu(): print("[1] Products") print("[2] Clients") print("[3] Display") print('[4] Report') print("[0] Exit the program.") def products(): #Adăugarea/ Ștergerea/ Actualizarea unui nou produs print("[1] Add new product") print("[2] Product update") print("[3] Delete product") print('[4] Go back to main page') print("[0] Exit the program.") def clients(): #Adăugarea/ Ștergerea/ Actualizarea unui nou client print("[1] Add new client") print("[2] Client update") print("[3] Delete client") print('[4] Go back to main page') print("[0] Exit the program.") def display(): #Afișarea listei de produse/ clienți #Afișarea unui client/ produs specific print("[1] Search list of: ") print("[2] Search a: ") print('[4] Go back to main page') print("[0] Exit the program.") def reports(): #Media de varsta a clientilor #Prețul mediu al produselor print("[1] Average age of clients: ") print("[2] The average price of the products ") print('[4] Return to the main menu') print("[0] Exit the program.") def option3(): print("Optiunea 3!") menu() option = int(input("Enter your option: ")) while option != 0: if option == 1: products() elif option == 2: clients() elif option == 3: display() elif option == 4: reports() else: print("Invalid option.") menu() -------->>>> this 2 line option = int(input("Enter your option: ")) # sa nu intre in bucla print("E gata!")
Output:[1] Products
[2] Clients
[3] Display
[4] Report
[0] Exit the program.
Enter your option: 1
[1] Add new product
[2] Product update
[3] Delete product
[4] Go back to main page
[0] Exit the program.
[1] Products --->>> this output
[2] Clients
[3] Display
[4] Report
[0] Exit the program. ---> until here
Enter your option: