for
` loops :# Nested for loop
adj = ["red", "big", "tasty"]
fruits = ["apple", "banana", "cherry"]
for x in adj:
for y in fruits:
print(x, y)
print("Done.")
red apple
red banana
red cherry
big apple
big banana
big cherry
tasty apple
tasty banana
tasty cherry
Done.
for
` loops to iterate over two separate lists : `adj
` and `fruits
`. The outer loop iterates over the adjectives in `adj
`, while the inner loop iterates over the fruits in `fruits
`.print()
` function to print a combination of each adjective and fruit.print()
` statement outside the loops, which prints the message "Done
."for
` loops to iterate over multiple lists or nested data structures. Each loop will iterate over the items in its respective data structure, and the inner loop will execute for each iteration of the outer loop.