how to add numbers in python using for loop

n = input("Enter Number to calculate sum")
n = int (n)
sum = 0
for num in range(0, n+1, 1):
    sum = sum+num
print("SUM of first ", n, "numbers is: ", sum )

Here is what the above code is Doing:
1. We are taking input from the user and converting it to integer.
2. We are creating a variable sum and initializing it to 0.
3. We are using for loop to iterate from 0 to n.
4. We are adding the value of num to sum.
5. We are printing the sum.