input: Write a function to sort a list of dictionaries by a specified key using a lambda function.
  assert sort_by_key([{'name': 'Alice', 'age': 30}, {'name': 'Bob', 'age': 25}, {'name': 'Charlie', 'age': 35}], 'age') == [{'name': 'Bob', 'age': 25}, {'name': 'Alice', 'age': 30}, {'name': 'Charlie', 'age': 35}]
  assert sort_by_key([{'name': 'Alice', 'score': 50}, {'name': 'Bob', 'score': 75}, {'name': 'Charlie', 'score': 60}], 'score') == [{'name': 'Alice', 'score': 50}, {'name': 'Charlie', 'score': 60}, {'name': 'Bob', 'score': 75}]
  assert sort_by_key([{'brand': 'Toyota', 'price': 20000}, {'brand': 'Honda', 'price': 18000}, {'brand': 'Ford', 'price': 22000}], 'price') == [{'brand': 'Honda', 'price': 18000}, {'brand': 'Toyota', 'price': 20000}, {'brand': 'Ford', 'price': 22000}]
output: def sort_by_key(lst, key):
      return sorted(lst, key=lambda x: x[key])