A running watch logs your heart rate every minute as text, and now and then a reading breaks and comes out as something like "--". Write heart_rates(readings) to turn every reading that can be a whole number into one and return them in order, skipping the broken ones.
heart_rates(["72", "--", "75"])→[72, 75]heart_rates([])→[]def heart_rates(readings):
good = []
for text in readings:
# your code here: try to turn text into an int and add it to good; skip it on ValueError
pass
return good
Run tries the examples. When they look right, Submit.