Nested for loops : For : Statement PYTHON TUTORIALS


PYTHON TUTORIALS » Statement » For »

 

Nested for loops


items = ["aaa"111(45)2.01]        # A set of objects
tests = [(45)3.14]                    # Keys to search for

for key in tests:                         # For all keys
    for item in items:                    # For all items
        if item == key:                   # Check for match
            print key, "was found" 
            break 
    else
        print key, "not found!"



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Statement
» For