This is known as a 'For Loop' in python programming language
program
prices = [10, 20, 30]
total = 0
for price in prices:
total += price
print(f"Total: {total}")
output
This is a python program that calculates the sum of the items in the list.
It gives an output of 60
This is known as a 'Nested loop' in python programming language
input
for x in range(4):
for y in range(3):
print(f'({x}, {y})')
output
it gives an output of
(0, 0)
(0, 1)
(0, 2)
(1, 0)
(1, 1)
(1, 2)
(2, 0)
(2, 1)
(2, 2)
(3, 0)
(3, 1)
(3, 2)