Question: What is the correct Python code to add integers from 1 to 1 0 and store in the variable sum? Question 5 options: sum =

What is the correct Python code to add integers from 1 to 10 and store in the variable sum?
Question 5 options:
sum =0
for i in range(10):
sum += i
It cannot be done using the for loop in Python. A while loop should be used.
sum =0
for i in range(1,11):
sum += i
sum =0
for (i=1; i<=10; i++):
sum += i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!