How to print only the last result of an array of sum in python

I’m resolving a problem, The user input a natural number, and I have to return the final sum of the numbers from 1 to the number in the input, I solved it like this: number=int(input("enter a natural number")) if number<0: print("The number is not positive") else: n=0 for i in range (1,number+1): n+=i print(n) For… Read More How to print only the last result of an array of sum in python