I'm finishing up an assignment but the thing is that it says 'restart' is undefined even though it's defined throughout the assignment.
I've had errors on where it was local so I made it global but now it says that 'restart' is undefined
def main():   
        global restart
        def changeMyList(myList):
            for i in range(len(myList)):
                myList[i] = myList[i].title()
            myList.sort()
        soccer_teams = ["Arsenal", "Chelsea", "Liverpool", "Barcelona", "Juventus", "Manchester City", "Atletico Madrid", "Borussia Dortmund"]
        team_length = len(soccer_teams)
        changeMyList(soccer_teams)
        print("|||||" + str(team_length) + " TEAMS" + "|||||")
        import random
        for team in soccer_teams:
            print(team)
        shuffle_user = input("Reshuffle? Y/N: ")
        if shuffle_user == 'y':
            random.shuffle(soccer_teams)
            print("List after first shuffle: ", soccer_teams)
            random.shuffle(soccer_teams)
            print("List after second shuffle: ", soccer_teams)
            restart = input("Run Again? Y/N: ").lower()
        if restart == 'y':
                        main()
        elif restart == 'n':
                        exit
main()
When I press 'n' when it asks to reshuffle it says "name 'restart' is not defined" line 32; line 40
 
     
    