Hi I'm new to Python.

I can't seem to go back to a submenu. Using continue or break will make it go to the MAIN menu. Will using def help? If so, how is def used in that situation?

Always read the documentation if in doubt:
PyDoc - def

As for you, here's an example of a submenu (Python 3.x):

def firstMenu():
    print ('''This is the first menu
1. Hello
2. World
3. Submenu
q - exit
    ''')
    while True:
        answer = input("Insert command: ")
        if answer == "1": print("Hello")
        elif answer == "2": print("World")
        elif answer == "3": 
            secondMenu()
            print("Welcome back.")
        elif answer == "q": 
            print("Leaving program.")
            break
        else: print("Invalid command.")


def secondMenu():
    print('''This is the second menu
1. Say second
2. Say menu
q - return to previous menu.
    ''')
    while True:
        answer = input("Insert command: ")
        if answer == "1": print("Say: second.")
        elif answer == "2": print("Say: menu")
        elif answer == "q": break
        else: print("Invalid command.")

firstMenu()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.