这是我必须解决的问题:编写一个程序来对用户输入的一系列数字求和。该程序应首先提示用户要对多少数字求和。然后它应该输入每个数字并打印总和。这是我到目前为止所拥有的:
def excercise13():
print("Programming Excercise 13")
print("This program adds a series of numbers.")
while True:
try:
numberTimes = float(input("Enter how many numbers will be added: "))
except ValueError:
print("Invalid input.")
else:
break
numberTimes = int(numberTimes)
while True:
try:
for i in range(1,(numberTimes+1)):
("""I don't know what to put here""")
except ValueError:
print("Invalid input.")
else:
break
totalSum =
print("The sum of",nums,"is:",totalSum)
print()
excercise13()