+ 1
Why else can pair with if 🧐
Why this code works 🤔 I think the indentation is not correct. https://code.sololearn.com/cDSXBXNXmAB1/?ref=app
3 Respostas
+ 6
I think you are asking about the last else ... The else after for loop is executed if we don't break inside for loop...Read this article it may help you http://book.pythontips.com/en/latest/for_-_else.html
Edit2:Also check this code ,it has used for..else
https://code.sololearn.com/c9IDPDyYW0vj/?ref=app
0
the else attached to the for wont make a difference as the for loop will be repeated after its completion from the while loop, thus c will still increment with it. 🧐
- 2
عزیزخاکسار
۰۹۱۹۴۹۳۸۵۳۹