需要帮助遍历嵌套列表但是

Need help iterating through a nested list but

'''

patients = [[175.8, 73.4], [180.2, 59.5], [165.4, 70.2], [193.5, 120]]

def calculate_bmi(height, weight):
    return weight / ((height / 100 )**2)

def get_bmi_category(bmi):
    if bmi < 18.5:
        return "underweight"
    elif bmi < 25.0:
        return "normal weight"
    elif bmi < 30:
        return "overweighting"
    else:
        return "obesity"

for patient in patients:
    height, weight = patients[0]
    bmi = calculate_bmi(height, weight)
    bmi_category = get_bmi_category(bmi)
    print("Patient's BMI is: {} ({})".format(bmi, bmi_category))

'''

当我打印时,当我想要所有嵌套循环的结果时,我只得到第一个嵌套列表的结果四次。我还能做什么?

height, weight = patients[0] 更改为 height, weight = patient

以下代码行有问题

 height, weight = patients[0]

以上只会将 [175.8, 73.4] 的值分配给身高和体重。 更新如下

height, weight = patient

for height, weight in patients:
#in this case you'll have to remove, height, weight = patients[0]