Udacity gives students a web editor to enter Python programs. The editor recognizes Python keywords and built-in functions and allows to run a program. Do you know how this tech
While javascript python interpreters do exist: http://syntensity.com/static/python.html , they don't appear to be using one. It would be far too easy to cheat if they didn't at least run the programs once for verification on their own interpreter.
After looking at the network activity on Udacity I can see that they make an ajax call with a bunch of data and then get the results of the program run back in JSON.
At a guess they have the standard python interpreter running in a sandbox that will execute the assignments, then the results are packed into JSON, returned to the client and updated to the screen. At the same time the results of your submission will be recorded as part of your class results.
I haven't tried Udacity, but for the syntax highlighting parts, it can be easily done with a simple backend code, which is updated using some Ajax. One of the easiest ways can be used as lexical analyzing as in compilers or interpreters ..
Very late to the party here, but I work as an engineer at Udacity, so I figured I'd give it a shot.
There are two fundamental things going on:
Not quite as fast as running it locally, but it sure beats supporting a few hundred thousand people trying to install Python for the first time ;)