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 50.
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 50 :
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 10
break statement for runs greater than or equal to 50
**
Fthese are the starting values
runs =0
x=-108000000000800
Awrite our complete loop here
 Let's add a second break statement to exit the loop if

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!