Recursive Sum to N

Write a recursive function sum_to(n) that returns the sum of all integers from 1 to n inclusive (matching the lesson's own Challenge task).

Read n and print the result.

Example: 4 → 1 + 2 + 3 + 4 = 10.

main.py
Loading editor…

Console

Run your code to see output here.