lundi 22 février 2016

Python Invalid Else Placement (Beginner)

I'm getting a syntax error after an else statment. Is it due to indentation?

    if choice == 2:
        actor = input('Enter actor:')
        actorLower = actor.lower()
        for name in actors:
            nameLower = name.lower()
            if actorLower in nameLower:
                print(actors[name])
        else:
            print('Actor not found')
    elif choice == 1:
        movie = input('Enter movie:')
        print(moviedict[movie])
        else:  #**This is where I'm getting the syntax error**
            print('Movie not found')

    elif choice != 0:
            print('Invalid choice')
                       query('movies.txt')  

Aucun commentaire:

Enregistrer un commentaire