+ 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 Answers
+ 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