📜  如何在python代码示例中添加范围总和

📅  最后修改于: 2022-03-11 14:46:46.953000             🧑  作者: Mango

代码示例2
n = input("Enter Number to calculate sum")
n = int(n)
res = sum(range(1, n+1))
print("SUM of first ", n, "numbers is: ", res)