input: Write a function to predict the next day's forecast temperature using the exponential smoothing algorithm given the past three days' forecast temperatures. The function should return the predicted temperature. If the input list is empty, the function should return 0.
  
  assert predict_temperature([21, 22, 20])==21.0
  assert predict_temperature([23, 24, 22])==22.5
  assert predict_temperature([18, 19, 17])==18.0
  assert predict_temperature([])==0
output: def predict_temperature(past_temps):
      if not past_temps:
          return 0
      alpha = 0.5
      smoothed_temp = past_temps[-1]
      for temp in past_temps[-2::-1]:
          smoothed_temp = alpha * temp + (1 - alpha) * smoothed_temp
      return smoothed_temp