ネストされたループにある数値のリストの合計を見つけるにはどうすればよいですか?
s=0
people=eval(input())
for i in range(people):
firstn=input()
lastn=input()
numbers=(eval(input()))
print(firstn, lastn, numbers)
for b in range(numbers):
numbers=eval(input())
s+=numbers
print(b)
入力は次のとおりです。
5 #nubmer of people I need to calculate
Jane #firstname
Doe #lastname
4 #number of floats for each person, pretty sure this is for the second loop
38.4 #these are the floats that i need to calculate for each person to find their sum
29.3
33.3
109.74
William #loop should reset here as this is the next person's first name
Jones
2
88.8
99.9
firstname
lastname
number of floats
float1
float2...
ループごとの不定数の合計を計算する方法を見つける必要があります。現在私が抱えている問題は、ループが各人の各値をリセットしておらず、合計を取得していることです。