It's also basically impossible to cut-and-paste code from a web forum. Was that "else" from the inner or the outer "if"?
So many webforums strip leading indents from code. It's not like it looks right on the forum, and then gets inserted into your editor wrong. It's often not right on the source side either. So if you're trying to learn an algorithm from the Python code, you're SOL. This has happened to me.
However, that breakage does mean that you have to at least read the code a bit. You either get to avoid a potential security flaw or gain a deeper understanding of an algorithm.
Fixing syntax does not break your ability to learn an algorithm but it will get you closer to its description.
With Python you are generally SIL not SOL.
I've been writing Python for years and never had this problem.