doubts reg "for, if" in html

Hi firstly thank you
the loop and if you have added to coding has made life a lot easier.
That got me wondering how does the python based logic works behind the scenes. And what untapped potential it has.
I would be grateful to anyone who could at the least give me a reference to
documentation or take some trouble to explain in brief.
Thank you, for your time.

I wouldn’t call this beginner-friendly material, but you can learn all about the Python language implementation by reading the language reference documentation.