45.3k views
2 votes
What does the following loop do?

val = 0
total = 0

while (val < 10):
val = val + 1
total = total + val
print(total)

Prints the numbers backwards from 10 to 1.

Prints the sum of the numbers from 1 to 10.

Finds the average of the numbers between 1 and 10.

Prints the numbers from 1 to 10.

User Prosseek
by
8.3k points

1 Answer

2 votes

Answer:

Prints the sum of the numbers from 1 to 10.

Step-by-step explanation:

YOU NEED BETTER INDENTATION

Total is the sum.

Each loop it's added

:)

User FOR
by
8.6k points