Skip to content

Latest commit

 

History

History
23 lines (13 loc) · 546 Bytes

File metadata and controls

23 lines (13 loc) · 546 Bytes

021 integral

📝 Instructions:

  1. With a given integral number n, write a function generate_dict that generates a dictionary that contains (i, i*i) that is an integral number between 1 and n (both included).

  2. generate_dict should then print the dictionary.

Example input:

generate_dict(8) 

Example output:

  • {1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64}

💡 Hints:

  • In case of input data being supplied to the question, it should be assumed to be a console input.

  • Consider use dict()