Delete from squares

Report a typo

We have a dictionary squares which contains numbers as keys and their squares as values. It looks like this:

squares = {1: 1, 3: 9, 5: 25, ...}

Your task is to read the input as a key that needs to be deleted from the dictionary and print the value of this key. If the number read from the input does not exist in the dictionary, then you need to print There is no such key. Finally, print the squares dictionary on the next line after all the changes.

The dictionary squares is already defined for you.

Sample Input 1:

4

Sample Output 1:

There is no such key
{1: 1, 3: 9, 5: 25, 6: 36, 8: 64, 10: 100, 11: 121, 15: 225}

Sample Input 2:

3

Sample Output 2:

9
{1: 1, 5: 25, 6: 36, 8: 64, 10: 100, 11: 121, 15: 225}
Write a program in Python 3





___

Create a free account to access the full topic