what is the importance of loop else statement in python
Answers
Answered by
1
Explanation:
- The else clause executes after the loop completes normally.
- This means that the loop did not encounter a break statement.
- They are really useful once you understand where to use them
Answered by
1
Tʜᴇ ᴇʟsᴇ ᴄʟᴀᴜsᴇ ᴇxᴇᴄᴜᴛᴇs ᴀғᴛᴇʀ ᴛʜᴇ ʟᴏᴏᴘ ᴄᴏᴍᴘʟᴇᴛᴇs ɴᴏʀᴍᴀʟʟʏ. Tʜɪs ᴍᴇᴀɴs ᴛʜᴀᴛ ᴛʜᴇ ʟᴏᴏᴘ ᴅɪᴅ ɴᴏᴛ ᴇɴᴄᴏᴜɴᴛᴇʀ ᴀ ʙʀᴇᴀᴋ sᴛᴀᴛᴇᴍᴇɴᴛ. Tʜᴇʏ ᴀʀᴇ ʀᴇᴀʟʟʏ ᴜsᴇғᴜʟ ᴏɴᴄᴇ ʏᴏᴜ ᴜɴᴅᴇʀsᴛᴀɴᴅ ᴡʜᴇʀᴇ ᴛᴏ ᴜsᴇ ᴛʜᴇᴍ.
Similar questions