Help me solve this problem in Python. Ladder

   

v20240901