← All examples Sum 1..n Python Loops for + range Flowchart (ISO 5807) StartInput ns = 0i = 1, n, 1s += iReturn sEndFigure 1 — total Source code def total(n): s = 0 for i in range(1, n + 1): s += i return s Open in the editor