我试图找到厨房(18.0)和卧室面积(10.75)的总和
# Create the areas list
areas = ["hallway", 11.25, "kitchen", 18.0, "living room", 20.0, "bedroom",
10.75, "bathroom", 9.50]
# Sum of kitchen and bedroom area: eat_sleep_area
eat_sleep_area = sum(areas[3],areas[-3])
# Print the variable eat_sleep_area
print(eat_sleep_area)
但是当我尝试运行代码时,它说: TypeError: 'float' object is not iterable 另外我观察到,当我使用 min,max 等其他函数时,它工作得很好,谁能解释一下原因?
幕布斯7119047
拉风的咖菲猫
肥皂起泡泡
相关分类