Removing Elements from Dictionary by Key in Python

To remove an element from a dictionary, you can use the del operator. Let's look at an example. Let's say we have the following dictionary:

pythondct = {
  'a': 1,
  'b': 2,
  'c': 3
}

Let's remove the element with key 'a':

pythondel dct['a']

Let's look at the result:

pythonprint(dct) # {'b': 2, 'c': 3}
Задание 1

Given a dictionary:

pythondct = {
  'x': 1,
  'y': 2,
  'z': 3
}

Remove from it the element with key 'x'.

Задание 2

Given a dictionary:

pythondct = {
  1: 'a',
  2: 'b',
  3: 'c',
  4: 'd',
  5: 'e'
}

Write the code to get the following result:

python{1: 'a', 3: 'c', 5: 'e'}