Forloop Statement

Code and Output

# List of numbers
numbers = [ 6, 5, 3, 76, 182 ]

# Variable to store the sum
sum = 0

# iterate over the list
for val in numbers:
sum = sum + val

# Output: The sum is 272

print ("The sum is", sum)


Comments

Popular posts from this blog

WAN Technology

LO3 - Know the features and functions of information systems

WDD - LO1 - MANAGE SECURE SITES