else block is executed if the break statement is not executed with in the loop. else block is executed only when the loop is executed without any problem.
While loops, just like C and C++, loop through each iteration until either the condition is met or a break statement is called. Being that this is a loop... it is possible and rather easy to get stuck ...
๐Ÿ“˜ ๐ƒ๐š๐ฒ ๐Ÿ“๐Ÿ– ๐จ๐Ÿ ๐€๐ˆ ๐‰๐จ๐ฎ๐ซ๐ง๐ž๐ฒ โ€œOne thing that surprised me today: Pythonโ€™s while-else behaves very differently from normal if-else.โ€ Today I practiced two important programming concepts in ...
Coding is (of course) about building things to help others. However, creating programs and software has more to do with automating repetitive or complex tasks than anything else. Pythonโ€™s while loop ...