是否有無論如何存儲用戶總額的投入每籌集的金額?對於我在範圍內(b)變量
b=int(input("Please enter how many people have collected money: "))
for i in range(b):
a=int(input("Please enter the amount raised: "))
total =
是否有無論如何存儲用戶總額的投入每籌集的金額?對於我在範圍內(b)變量
b=int(input("Please enter how many people have collected money: "))
for i in range(b):
a=int(input("Please enter the amount raised: "))
total =
做一個列表的值存儲在:
b=int(input("Please enter how many people have collected money: "))
total = [0]*b
for i in range(b):
a=int(input("Please enter the amount raised: "))
total[i] = a
使用此: ` B = INT(輸入( 「請輸入有多少人收錢」))
總= []
爲i的範圍(b)中: 一個= INT(輸入( 「請輸入所提出的量:」)) total.a PPEND(一) 打印( 「總」,總和(總)) `
或者使用:
b=int(input("Please enter how many people have collected money: "))
total=0
for i in range(b):
total+=int(input("Please enter the amount raised: "))
這增加了每次迭代上total
您給定的輸入。
PROTIP:用您正在使用的* language *標記問題。 –