input: Write a function to create a Python dictionary where the list of people's names are keys and their respective ages are values. If the input is empty or invalid, return an empty dictionary.
  assert create_people_dict(['John (20)', 'Jane (40)', 'Alex (18)', 'Peter (45)'])=={'John': 20, 'Jane': 40, 'Alex': 18, 'Peter': 45}
  assert create_people_dict([])=={}
  assert create_people_dict(['Alice (30)', 'Bob (25)', 'Charlie (42)'])=={'Alice': 30, 'Bob': 25, 'Charlie': 42}
  assert create_people_dict(None)=={}
  assert create_people_dict(['Sam (28)'])=={'Sam': 28}
output: def create_people_dict(people):
      if not people:
          return {}
      result = {}
      for person in people:
          name, age = person.split(' (')
          age = int(age.rstrip(')'))
          result[name] = age
      return result