def choose_speed(distance): if distance < 20: return 0 return 30