The high-jump results (in cm) are in a list. Write silver(heights) to return the second-best height: a jump as high as the winner's does not count as second. If everyone jumped the same, or the list is empty, return None.
silver([120, 135, 128])→128silver([140, 140, 130])→130silver([110, 110])→Nonedef silver(heights):
if len(heights) == 0:
return None
best = max(heights)
others = []
for h in heights:
# your code here: lower than best goes into others
pass
# your code here: None if others is empty, else its biggest
return None
Run tries the examples. When they look right, Submit.