이것은 해결해야 할 문제입니다. 사용자가 입력 한 일련의 숫자를 더하는 프로그램을 작성하십시오. 프로그램은 먼저 얼마나 많은 숫자가 합산되어야하는지 사용자에게 알려야합니다. 그런 다음 각 숫자를 입력하고 총계를 인쇄해야합니다.변수에 저장할 숫자를 추가하는 방법은 무엇입니까?
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()
여러분은 여기 숙제를하지 않습니다. 특정 질문이있는 경우 명확하게 질문해야합니다. 즉, 합계가 필요한 숫자를 읽는 데 사용한 것처럼 input을 사용하지 않는 이유는 무엇입니까? – jszakmeister