text: If you're new to Python
  and VPython: Introduction
  A VPython tutorial
  Pictures of 3D objects
  What's new in VPython 6
  VPython web site
  VPython license
  Python web site
  Math module (sqrt etc.)
  Numpy module (arrays)
  The interactive development environment you will use is called "VIDLE." or copy the following simple program into the code
  window in VIDLE and run it (press F5, or use the Run menu), you will see
  a display like the one shown in the figure.
  from visual import *
  redbox=box(pos=vector(4,2,3),
  size=(8,4,6),color=color.red)
  ball=sphere(pos=vector(4,7,3),radius=2,color=color.green)
  Visual is the name of the 3D graphics module used with
  the Python programming language. VPython is the name of the combination
  of the Python programming language, the Visual module, and the development
  environment VIDLE.
  In the display window, click and drag with the right mouse
  button (hold down the command key on a Macintosh). Option key). may
  create new attributes. For example, you might create a sphere named moon;
  in addition to its radius and location, you might give it attributes such
  as mass (moon.mass) and momentum (moon.momentum).)
  b = vector(4,5,6)
  c=a+b
  If you print c , you will find that
  it is a vector with components (5, 7, 9.).
  d = 3*a # d is a vector with components (3, 6, 9)
  s = mag(c) # s is a scalar
  z = mag(c)**2 # you can square the magnitude of a vector
  f = cross(a,b) # cross product
  g = dot(a,b) # dot product
  h = norm(a) # normalized (unit) vector; a/mag(a)
  The attributes of VPython) # an.
  If you are using a version of Python prior to Python 3.0, division of integers will not come out the way you may expect, since the result is rounded down to the nearest integer. Thus:
  a = 3/4
  print(a) # a is 0
  To avoid this, you can place a decimal point after every number, like
  this:
  b = 3./4.
  print(b) # b is 0.75, as expected
  We recommend putting the following statement as the
  first line of your program, in which case 3/4 will be 0.75; there
  are two underscores before the word "future" and two after the word "future"; also, it will display print statements properly on all versions of Python:
  from __future__ import division, print_function
  This is not necessary for Python versions starting with 3.0, which ignore this statement.
  x**2 # Not x^2, which is a bit operation in Python
  If, elif ("else if"), else:
  if a == b: # see table of logical expressions below
  c = 3.5 # indented code executed if test is true
  elif a < b:
  c = 0 # c will be set to zero only if a < b
  else:
  c = -23.2
  ==
  equal
  !=
  not equal
  <
  less than
  >
  greater than
  <=
  less than or equal
  >=
  greater or equal
  or
  logical or
  and
  logical and
  in
  member of a sequence
  not in
  not sequence member(10) # integer argument -> integers
  print(numbers) # [0,1,2,3,4,5,6,7,8,9]
  The simplest loop in Python is a "while" loop. The loop continues as long as the specified logical expression is true: choosing "Stop Program" from the Run menu in VIDLE.
  To print a number, a vector, a list, or anything else,
  use the "print" option:
  print(Europa.momentum)
  To print a text message, enclose it in quotes:
  print("We crashed on the Moon with speed", v, "m/s.")
  Python also offers a formatted print capability. Here
  price will be printed with 3 digits before the decimal place and 2
  digits after, and num will be printed as an integer:
  print("It's $%3.2f dollars for %d copies" %
  (price,num))
  We have summarized a small but important subset of the Python programming
  language. Extensive Python documentation is provided
  on the Help menu in VIDLE, and there is additional information at the Python
  website, but much of this information assumes that you already
  have
  lots of programming experience in other languages. We recommend the
  following
  book to those who want to learn more about Python, and about programming
  in general: Python Programming: An Introduction to Computer Science by
  John M. Zelle (Franklin Beedle & Associates, 2003).