input1 = raw_input("Hello enter a list of numbers to add up!")
lon = 0
while input1:
input1 = raw_input("Enter numbers to add")
lon = lon + input1
print lon
该程序应该添加所有给定的数字。它不起作用,所以我尝试列出一个列表:
input1 = raw_input("Hello enter a list of numbers to add up!")
lon = []
while input1:
input1 = raw_input("Enter numbers to add")
lon.append(input1)
print sum(lon)
它仍然不起作用?任何解决方案为什么?我是 Python 的初学者,并且只做了大约一个月。谢谢!