234k views
5 votes
Create a dictionary that maps the first n counting numbers to their squares. Associate the dictionary with the variable squares.

User Declension
by
4.7k points

1 Answer

6 votes

Answer:

The code in python is attached.

Step-by-step explanation:

  1. a function called mapper is defined
  2. the function accepts n as an integer parameter.
  3. returns a dictionary which maps the first n counting numbers to their squares.
  4. then variable called squares is associated with the dictionary when n=5
Create a dictionary that maps the first n counting numbers to their squares. Associate-example-1
User Pathdependent
by
4.7k points