Sum from 1 to n
easyBasics10 XP
Return 1 + 2 + … + n. For n of 0 the answer is 0.
Examples
- Input: n = 5Output: 15
- Input: n = 1Output: 1
Examples use JSON: true/false/null are True/False/None in Python.
Return 1 + 2 + … + n. For n of 0 the answer is 0.
Examples use JSON: true/false/null are True/False/None in Python.
Run examples checks the examples above. Submit also runs 3 hidden tests.