The for loop execute a sequence of statement multiple times. The for loop is also called as a per-tested loop.
Syntax
for iterating_var in sequence: statements(p)Flow Diagram:
Eg:
num = [2,3,4,5,6,7,9,6,8,12,44]
sum = 0
for val in num:
sum = sum+val
print("The sum is", sum)
OUTPUT:
The sum is 106
Post a Comment