Also here's a more compact example:
https://glowscript.org/#/user/dborrero/folder/Public/program/Test3
This is

After some great sleuthing by Jed Rembold, it appears that Python 3 does some funny things with mixed tabs and spaces. I think that the last loop for some reason is interpreted as being at the same indentation level as the middle loop. So the middle loop is considered empty (which should throw an error but doesn't), runs to completion (that's why we only get the last value for theta) and then the last loop runs as if it were in the first indentation level instead of the second. How any of this maps to the Glowscript -> Javascript transpilation, I have no idea.
Note that trying to run those from text files as regular python by running "python filename" in Anaconda shell (Python 3) both throw errors (first one throws and indentation error and the other throws a mixed tabs and spaces error).
I think the mixed tabs and spaces occurred because I modified some old file from Georgia Tech ca. 2009 (probably me, Matt Kohlmyer, or Danny Caballero wrote it) that had a bunch of tabs and changed things in 2021, but replaced some of the tabs with spaces. Regardless, I think that distributing code out to students to complete is common enough that this rather esoteric behavior should probably be addressed.