How do I break a loop that outside the function by using the functions to do so? Here is my code:
for x in range(5):
def display_grid():
if px == 1:
print
print "Invalid input, please Use the format \'x,y\'"
print
return
elif nx == 1:
return
print '\n' *30
print p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10 + p11 + p12 + p13 + p14
return
while i > 0:
display_grid()
break
The return only breaks the function and the loop being a conditional it will keep printing the statements above only 5 times , I want it so that it will keep printing it until the conditions are not met. Thank you!
returnsome value from function (my_value = display_grid()), and depend on that value (e.g. if value wasTrueorFalseeitherbreakfrom loop or stay in it.pxandnx?