Question: 5. (10 points) In Python, a loop (either for or while) could have an else part - the statements in the else part will

5. (10 points) In Python, a loop (either for or while) could 

5. (10 points) In Python, a loop (either for or while) could have an else part - the statements in the else part will be executed only when a loop terminates normally. Here is one illustration of using else with a loop. for count in range (100): else: ...stmts... if count == userChoice: ...stmts... break print("finished the loop completely") (1) What is the advantage of introducing else with a loop? (2) What is the problem of using else with a loop? #note: your answer may cite a criterion and briefly explain why it enhances or hurts that criterion. Answer: (1) (2)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 The advantage of introducing an else part with a loop is that it provides a way to execute specifi... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Operating System Questions!