logo CodeStepByStep logo


Language/Type: Python errors loops return

What is wrong with the following code, which attempts to add all numbers from 1 to a given maximum? Correct the code so that it properly implements this behavior. For example the call of sum_to(5) should return 1+2+3+4+5 or 15. You may assume that the value passed is at least 1.

Function: Write a Python function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.