Last answered:

26 Dec 2021

Posted on:

10 Dec 2021

0

Resolved: doubt in example provided

Hi,

First element for this code should be 0 - please confirm.
0 2 4 8 16 32 64 128 256 512
image.png

3 answers ( 1 marked as helpful)
Instructor
Posted on:

10 Dec 2021

0

Hi Rajesh!

Thanks for reaching out.

The numbers displayed after executing the loop in Python are correct. 2 to the power of 0 equals 1, not 0. So, the output is indeed correct.

Hope this helps.
Kind regards,
Martin

Posted on:

10 Dec 2021

0

Dear Martin,

Thanks for the clarity.. I thought 2^0 is 0 - my mistake. Jus rechecked in google too. :)

thanks again

Instructor
Posted on:

26 Dec 2021

1

You are very welcome!
Kind regards,
Martin

Submit an answer