def sum(n): result = 0 i = 1 while i <= n: result += i i += 1 return result