+ 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

6th May 2019, 4:37 PM
Gordon
Gordon - avatar
3 ответов
+ 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
6th May 2019, 4:41 PM
Saksham Jain
Saksham Jain - avatar
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. 🧐
7th May 2019, 2:56 AM
Choe
Choe - avatar
- 2
عزیزخاکسار ۰۹۱۹۴۹۳۸۵۳۹
6th May 2019, 10:30 PM
azezkan Kan
azezkan Kan - avatar