← Back to challenges

Just Another Sum Problem But... 😰😱

PythonHardalgebraalgorithmslanguage_fundamentals

Instructions

Ok, the challenge is kind of easy, right?

The problem is not adding. The problem is that the numbers are not in order. Create a function that organizes the numbers and adds the numbers in the range between X and Y.

Here is an example:

X = -10 | Y=1

So this will be the range of numbers:

-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1

This will be your result:

-54

You must sum a number range between X and Y to get the result.

Remember, X and Y are disorganized, so to get to the result you know what you have to do.

Examples

just_another_sum_problem(-10, 1) ➞ -54

just_another_sum_problem(-20, 5) ➞ -195

just_another_sum_problem(90, 45) ➞ 3105
python3
Loading editor…
⌘ ↡ to run
Walks through the solution with reasoning and edge cases.
Next: A Simple Check β†’