Skip to content
>_
LearnPy Hub
☰ Menu
Learn
Practice
Compiler
Arena
Contest
About
◐
← Loops problems
Easy
Sum 1 to n
Read n and print 1 + 2 + … + n using a loop.
Input
One integer n ≥ 1.
Output
One integer.
Sample 1
Input
5
Output
15
Sample 2
Input
1
Output
1
solution.py
☀ Light
Clear
▶ Run
▶ Run samples
Submit
Output appears here
Sum 1 to n · Python practice problem · LearnPy Hub