for loop python

Posted by w3diy - 6 months ago

Nested Loops

A nested loop is a loop inside a loop.

adj = ["green", "tiny", "great"]
products = ["mobile", "laptop", "computer"]

for x in adj:
  for y in products:
    print(x, y)

Print each product in a product list:

products = ["mobile", "laptop", "computer"]
for x in products:
  print(x)