vendredi 9 juin 2017

Python: If a for loop ends

How do i test if a for loop ended? (Stopped looping)

I have tried: Using "Else" with a for loop. But this runs after everytime the loop loops,

Putting the code after the loop. But this runs before the loop is finished,

Using a while loop, if statement and a variable. Then. Added 1 to the variable everytime the loop finished. Then checked in a while loop to see if the variable matched the number the loop should end with. For some reason. This doesn't work

Aucun commentaire:

Enregistrer un commentaire