Day 22 - Grocery List App With Lists and Custom Functions, Part 1/2

Part 1 of 2 - We will use lists, with custom functions that accept parameters and return a list value.

Finished Code

liG = ["apples","milk", "eggs" ]
liG.sort()

# Declare custom functions.
def listG(liMain):
    print("\nHere is your grocery list:\n")
    intIndex = 0
    for strItem in liMain:
        print(intIndex, strItem)
        intIndex += 1
    print("\n")

#  Main part of the app
print("%"*60)
print("Grocery List App".center(60))
print("%"*60)

while True:
    # Menu
    print("\nMain Menu:")
    print("1. Add an Item")
    print("2. Remove an Item")
    print("3. List Items\n")
    strMenu = input("Choose Option 1-3: ")

    if (strMenu == "1"):
        pass

    elif (strMenu == "2"):
        pass

    elif (strMenu == "3"):
        #  List items in the list
        listG(liG)


    else:
        print("That isn't an option. Please try again.")

    strCont = input("Do you want to do anything else? (y/n): ").lower().strip()

    if (strCont == "y"):
        pass
    elif (strCont == "n"):
        break
    else:
        print("That isn't an option.\nReturning to Main Menu.")

print("Thank you for using the Grocery List app!")