Breaking Out of Loops : break « Statement « Python Tutorial






from math import sqrt 

for n in range(99, 0 -1):
    root = sqrt(n) 
    if root == int(root):
       print root
       break








3.5.break
3.5.1.Breaking Out of Loops
3.5.2.break out of a while loop
3.5.3.Use break to stop execution and break out of the current loop
3.5.4.break and continue Statements, and Else Clauses on Loops