-1
We are having difficulty executing an activity of POO.
To run the code block where the method we use displays an unexpected output (Semantic error).
 def acionamento(self, estado, nome_gerador): # acionar geradores
    try:
        self._nome == nome_gerador
        if estado == 'sim':
            print(nome_gerador, 'foi ligado!')
        if nome_gerador == 'G1':
            print('já esta ligado')
            raise Exception
    except Exception:
            print('o gerador não é gerenciado manualmente')
    if estado == 'nao':
        print(nome_gerador, 'solicitação cancelada!')
    else:
        pass
        #print('opção invalida!')
The answer for G1 is correct, as for the others (G2,G3,G4) the expected output is: G2 was turned on/or the request was canceled.
 deseja ligar o gerador?
1.sim 
2.não
Digite: sim
nome do gerador: g1
o gerador não é gerenciado manualmente
But for the others (G2,G3,G4) it is necessary to appear, example "G2 was turned on!"
    deseja ligar o gerador?
1.sim 
2.não
Digite: sim
nome do gerador: g2
o gerador não é gerenciado manualmente
How you would help us solve this problem attached?

Recommended reading, How NOT to Ask Questions Manual: Thinking we’ll do your job all for free
– Augusto Vasques
Friends, could you post the code of the object? It’s a bit confusing this code... But, look at line 11. That "if" is identable correctly?
– LEduardoCardozo