PY
Python Examples


Python is a scripting language.

This directory contains some simple examples of Python scripts.

Licensing:

The computer code and data files described on this web page are distributed under the GNU LGPL license.

Languages:

General language examples include: a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version and a Python version.

Related Data and Programs:

Simple example programs or scripts are also available for a C version, and a C++ version, and a FORTRAN77 version, and a FORTRAN90 version, and a MATLAB version.

Source Code:

DATA_EXAMPLE shows how a computation can be set up in which certain problem-associated data can be defined by the user, and then later accessed by the computation. A class can be set up so that when a member of the class is created, data values may be associated with it and retrieved as needed, in a standard way. This avoids the use of static or global or persistent or common variables that are used in other languages.

HELLO is a simple example to print out "Hello, world!".

MAIN_DEMO shows how a Python file can include text that only executes if the file is called directly, as a "main program". In that case, the text might, for instance, run a demonstration or test of the functions within the file.

SUPPRESS_SPACES demonstrates that, when printing, you can suppress the spaces that are automatically inserted between successively printed items.

You can go up one level to the PYTHON source codes.


Last revised on 19 August 2015.