Define nested For loop. With examples. Write both the examples. (with output so that in future you can understand the program)
Answers
Answered by
0
Answer:
The placing of one loop inside the body of another loop is called nesting. When you "nest" two loops, the outer loop takes control of the number of complete repetitions of the inner loop. While all types of loops may be nested.
For eg.
adj = ["red", "yellow", "tasty"]
fruits = ["apple", "banana", "cherry"]
for x in adj:
for y in fruits:
print(x, y)
Output:
red apple, yellow banana, tasty cherry
Hope it helps you : )
Similar questions
Computer Science,
1 month ago
Math,
3 months ago
Math,
3 months ago
Math,
9 months ago
Math,
9 months ago