Help me rewrite the code from c++ to Python I just started learning Python and found a solution to the problem in c++, but I can\'t find it in Python, I just want to underst