Last answered:

10 Nov 2021

Posted on:

01 Feb 2021

3

The implementation and the explanation of the algorithm are somewhat different

When he explains the algorithm he begins with all "heads" and counting 2 by 2.  The python code begins all "tails" counting 1 by 1.  This ends up with the same result obviously because the first iteration sets the list into all "heads".  In addition, he switches up to n=qty of coins in the explanation and in the code he goes up to n=qty-1.  Since he ends up getting a "tail" in the last position this doesnt screw up the final result where only "heads" are selected.

2 answers ( 0 marked as helpful)
Instructor
Posted on:

15 Feb 2021

0

Hi daniel,
thanks for pointing this out! There is a slight difference, indeed, hopefully other students will be able to follow along, as well.

Best,
Elitsa

Posted on:

10 Nov 2021

0

Is there no particlar stepwise coding process in solving coding questions? For beginners like me, I think a step wise approach will help.
The course is great, but I still need to watch the lessons over and over the grasp the details more

Submit an answer