input: from typing import List
  
  
  def create_people_dictionary(names_and_ages: List[str]) -> dict:
      """ Create a dictionary from the given list where each element is in the format 
      "Name (Age)". The keys of the dictionary should be the names and the values 
      should be their corresponding ages.
      >>> create_people_dictionary(['John (20)', 'Jane (40)', 'Alex (18)', 'Peter (45)'])
      {'John': 20, 'Jane': 40, 'Alex': 18, 'Peter': 45}
      """
output:     people_dict = {}
      for item in names_and_ages:
          name, age = item.strip().split(' (')
          age = int(age.rstrip(')'))
          people_dict[name] = age
      return people_dict