#forsum.py
n = input('How many numbers to sum?')
total = 0
for i in range(n):
s = raw_input('Enter number' + str(i + 1) + ':')
total = total + int(s)
print('The sum is ' + str(total))
*for计算用户输入的数字的总和
最新推荐文章于 2022-10-11 19:37:20 发布
#forsum.py
n = input('How many numbers to sum?')
total = 0
for i in range(n):
s = raw_input('Enter number' + str(i + 1) + ':')
total = total + int(s)
print('The sum is ' + str(total))