You can download this code by clicking the button below.
This code is now available for download.
Compute the sum of all integers from 1 to n
Technology Stack : Built-in functions sum() and range()
Code Type : Mathematical calculation function
Code Difficulty :
def sum_to_n(n):
return sum(range(1, n+1))