下面Python代码用于求1到N之和,N为正整数。因为 range()\mathrm{range}() 中为 N+1N+1,因此是1到N且包含N之和。( )

N = int(input("请输入正整数:"))total = 0for i in range(1, N + 1):total += iprint(total)
填写答案