input: Write a function that converts ratings in a list of strings to a list of floats. If a rating is not a valid number, it should be converted to 0.0. The function should be named 'str_to_float'.
  
  assert str_to_float(['4.5', '3.0', '2.5', '4.0', 'xyz']) == [4.5, 3.0, 2.5, 4.0, 0.0]
  assert str_to_float(['1.2', 'hello', '3.4']) == [1.2, 0.0, 3.4]
  assert str_to_float(['0.0', '-2.3', 'NaN']) == [0.0, -2.3, 0.0]
  assert str_to_float([]) == []
  assert str_to_float(['', '1', '2E3']) == [0.0, 1.0, 2000.0]
output: def str_to_float(ratings):
      return [float(rating) if rating.replace('.', '', 1).lstrip('-').isdigit() else 0.0 for rating in ratings]