vendredi 26 octobre 2018

Can't figure out what's wrong with my Python3 if/else logic

It seems to be doing a sort of iteration down instead of meeting the if/else demands. I tried printing (type(result)) after every result, all the input results show up at the end of the block, e.g.

"Type a string"
> Pi 
"Type a string"
>Lo

etc. (it continues down the block when it shouldn't with these inputs) and then at the end shows the inputs

Pi
Lo

orsor and alike are input('string'(['dictionary'])) tested alone the function works fine but building into it I'm getting logic issues. Thank you.

print(orsor) 
result = orsor
if (result == 'Di'): 
    print(drace2)
    result = drace2

    if (drace2 == 'Ao'):
     print(aossi2)
     result = aossi2



    elif (result == 'El'):
        print(el2)
        result = el2


    elif (result == 'Un'): 
        print(undin2)
        result = undin2 



    else:
        Exit()

Aucun commentaire:

Enregistrer un commentaire