input: Write a function to use the exponential smoothing algorithm to predict the next day's forecast temperature given the past three day's forecast temperatures. The function should take a list of past temperatures as input and return the predicted temperature. If the list is empty, return 0.
  assert predict_temperature([21, 22, 20])==21.0
  assert predict_temperature([23, 25, 24])==24.0
  assert predict_temperature([18, 19, 20])==17.5
  assert predict_temperature([15, 16, 14])==12.0
  assert predict_temperature([])==0
output: def predict_temperature(past_temperatures):
      if not past_temperatures:
          return 0
      alpha = 0.5
      smoothed_value = past_temperatures[0]
      for temp in past_temperatures[1:]:
          smoothed_value = alpha * temp + (1 - alpha) * smoothed_value
      return smoothed_value