Python for else loop | Just enough Python

Publicado em: 23 Setembro 2019
no canal de: Ajay Tech
27
1

This is a syntax that is kind of unique to Python. The syntax applies equally well with while statement as well. It is more of a convenience function, but newbies get confused with this syntax some times. It basically means that if nothing is found in the loop, do something in the else part. Typically, when searching for something in a loop, we want to do something when nothing has been found – How would we know if the loop ended because of a break statement or if the loop has completed all of its iterations ?

The else in for else is used to indicate a situation where the loop has been exhausted, not broken.

https://ajaytech.co/python-loops/#for...


Nesta página do site você pode assistir ao vídeo on-line Python for else loop | Just enough Python duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Ajay Tech 23 Setembro 2019, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 27 vezes e gostou 1 espectadores. Boa visualização!