Question: Let's add a second break statement to exit the loop if the number of runs is greater than or equal to 5 0 . Inside
Let's add a second break statement to exit the loop if the number of runs is greater than or equal to
Inside of the loop from the last problem, add this AFTER the break statement, but outside of the previous if statement
a way to count the number of runs hint: use a counter variable "runs"
if runs is greater than or equal to :
this is what happens:
print "Maximum iterations reached"
break the loop
your code after this problem should now be
while
actions
break statement for greater than
break statement for runs greater than or equal to
Fthese are the starting values
runs
Awrite our complete loop here
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
