Python Forum
Add food choice to menu
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add food choice to menu
#5
If you were to use a list instead of a string as has been suggested:
menu = ['salad', 'pasta', 'sandwich', 'pizza', 'drinks']
you can use len to count how many items are in the starting list:
stating_menu_count = len(menu)
to add items to a list, use the list method append:
menu.append('spam')
by getting a new list count you can now calculate how many items have been added to the list:
added_menu_count = # ill leave you to work out this part
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,932 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