vendredi 26 juillet 2019

why other clauses after "IF" is not working, when nested in while loop finishes

hi I am trying to create very simple if else clause which has nested while loop like this.

    a = 10
    if a > 6:
        while a > 5: 
            a -= 1
            print("a in while loop")
    elif a == 5:
        print("a", a)
    else:
       print("Doing else")    

The issue is when while loop finished, it will not go elif nor else clause. I think I am missing something basic here. Could someone explain? I thought after while loop finished the code should check rest of the statements. Thanks in advance

Aucun commentaire:

Enregistrer un commentaire