Why “error” prints in last | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why “error” prints in last

I don’t know why and how “else” part is executed that is outside of loop ...plz explain 🥲 https://code.sololearn.com/ckIoqzH6CBeG/?ref=app

18th Feb 2021, 1:43 PM
Sarthak
Sarthak - avatar
1 Answer
+ 1
Abol if the for loop terminates by break statement then else doesn't executes. For example change it to x==5 and else won't execute,
18th Feb 2021, 2:56 PM
Abhay
Abhay - avatar