Week_5: Exersice1_Q4

The Question :
Write a program to generate a dictionary that contains the number between 1 and n in the form of (key:value)=(x:x2) where n=100. For ex:

If n = 7 then output will be = {0:0, 1:1, 2:4}

The example isn’t helping to deduce the require terminating condition.
If n=7, is ‘n’ the limiting case of x or x^2?

Please Help
Thanks

As shown in the example, the terminating condition is x^2 < n

It can be x^2 <= n also

How can we conclude its x^2 < n only?

1 Like

Looking at the question again, I agree with your argument.
It can be x^2 <= n as well.

Detailed look shows another problem in the example.
Question says : “generate a dictionary that contains the number between 1 and n
But the example includes 0.

I think the PadhAI team can clarify this.