
If you're new to Python A VPython tutorial Pictures of 3D objects 
Math FunctionsFor versions of Python prior to 3.0, Python performs integer division with truncation, so that 3/4 is 0, not 0.75. This is inconvenient when doing scientific computations, and can lead to hardtofind bugs in programs. In the GlowScript environment, where VPython code is compiled to JavaScript, 3/4 is always 0.75. The following math functions are provided: abs(x) Many of the quantities above are short forms of the JavaScript functions Math.abs(x), Math.sqrt(x), etc. Here are details of the factorial and combin functions.
In general, Python modules cannot be imported into VPython programs, because GlowScript VPython functions in a JavaScript environment. However, one can import the Python "random" module into a VPython program, provided by the RapydScriptNG tool that converts Python to JavaScript. One cannot use the form "from random import *" but must use "import random" or "import random as rr" (or other name) or "from random import randint, uniform" (or other list of functions). Here is documentation of the Python random module. You do not need to import the random module in order to be able to use the random() function described above.
There are functions for converting between degrees and radians, where there are 2*pi radians in 360 degrees: radians(360) # equal to 2*pi
See JavaScript documentation on the Date object which provides methods for determining the current day etc. Here is a way to determine elapsed time in seconds, with microsecond accuracy, using the clock() function that is also available in the standard Python "time" module. The displayed text is approximately 1.5: t1 = clock() There is also a function msclock() which gives the time in milliseconds instead of seconds.
You can use LaTeX to display mathematical expressions on the page. 
