Python Forum
Add food choice to menu
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add food choice to menu
#3
Thanks for taking the time to explain the concepts. I understand it better now as to why you suggested the things you do. No one explains these concepts when u go through an online lesson. Thanks!

As to point 5, I learn from the previous assignment I did as below.

def add_report(report):
    total = 0
    items = ""
    user = input("Enter an integer to add to toal or Q")
    while True:
        if report.upper() == "T":
            user_1 = input("Enter integer or Q to quit")
            if user_1.isdigit():
                total = int(user_1) + total
            elif user_1.upper() == "Q":
                print("\nTotal:\n",total)
                break
        elif report.upper() == "A":
            user_1 = input("Enter integer or Q to quit")
            if user_1.isdigit():
                total = int(user_1) + total
                items = items + "\n" + user_1
            elif user_1.upper() == "Q":
                print("\nItems\n",items,"\n","Total: ","\n",total)
                break
            else:
                print("Invalid input")
            
add_report("A")
There's this line, " items = items + "\n" + user_1 ", my understanding is this will loop the numbers as I input them and it will be called when this " print("\nItems\n",items,"\n","Total: ","\n",total) " is being executed. So I thought in my menu code, as I input the 4 choices, all these choices will be added but seems like it's not working. I'm kinda stuck now
Reply


Messages In This Thread
Add food choice to menu - by extricate - Jun-07-2020, 05:39 AM
RE: Add food choice to menu - by ndc85430 - Jun-07-2020, 06:24 AM
RE: Add food choice to menu - by extricate - Jun-07-2020, 07:04 AM
RE: Add food choice to menu - by DPaul - Jun-13-2020, 07:24 AM
RE: Add food choice to menu - by Yoriz - Jun-13-2020, 07:44 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Building a food delivery program ElenaPapagia 2 4,985 Dec-12-2020, 04:12 PM
Last Post: michael1789

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020