For loop combined with in function : For In « Language Basics « Python






For loop combined with in function

For loop combined with in function

from math import sqrt

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

           
       








Related examples in the same category

1.Loop can be applied to any 'iterable' objectLoop can be applied to any 'iterable' object