mercredi 12 mai 2021

This program prints nothing why is the else block in loop not working in python

I had this code which should print number for 0 to 10 and again 10 to 0 for 5 times

n = 0

for i in range(1,50):

    if(n == 10):
        while(n == 0):
            print(n)
            n -= 1

    else:
        while(n == 10):
            print(n)
            n += 1

Aucun commentaire:

Enregistrer un commentaire