Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Udacity web Python interpreter work?

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 technology works? Are programs submitted to a backend and executed by the standard Python interpreter or is it a JavaScript based Python interpreter? Does the editor simply hold a static list of Python keywords and built-in functions or does it interact with the standard or JavaScript based Python to obtain these?

like image 618
Jan Wrobel Avatar asked Sep 14 '12 15:09

Jan Wrobel


1 Answers

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.

like image 76
jmh Avatar answered Sep 19 '22 18:09

jmh