OneBite.Dev - Coding blog in a bite size

loop object in python

Code snippet on how to loop object in python

  for item in object: 
    print(item) 

This code uses a loop to print out the items in an object. The keyword “for” starts the loop, and “item” is an arbitrary placeholder for each item in the object. The keyword “in” signifies that the loop is based on the object. The keyword “object” represents the object which the loop applies to. “Print(item)” is the code which prints out the item, the placeholder for each item in the object. Finally, the colon ”:” symbol ends the loop. The loop prints out each item one-by-one until it runs out of items in the object.

python