list = "\n==== Names and Distances ====\n"
firstName = input ("Enter next person's first name >")
while firstName > "":
distance= float(input("Enter distance thrown: "))
lastName = input ("What is "+firstName+"'s last name?")
list = list + firstName[0] + "." + lastName + str(distance) + "\n"
firstName = input ("Enter next person's first name >")
high=float(max(distance))
low=float(min(distance))
print (list)
print ("The furthest distance is: " + high)
print ("The shorest distance is: " + low)
我得到错误'float'对象不可迭代。我很好奇我做错了什么,如果我完全不在写这段代码。
答案 0 :(得分:2)
您尝试在单个值上调用max()
和min()
。首先将值存储在列表中,然后再将其调用。