About a doubt

I am a beginner and I am stuck in a problem
In the practice section and beginner column
there is a problem named lead game
I am coding in python 3.6 and I tried to make a code
but failed in doing so
I can’t understand the logic behind that
I understood the problem but failed to implement my code according to that
Please help me out by sending a well explained python 3.6 code of the above mentioned problem