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 FORTRAN90 version and a MATLAB version and a Python 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!".

HSTACK_TEST shows how two or more arrays of the same row dimension can be horizontally stacked.

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.

VSTACK_TEST shows how two or more arrays of the same column dimension can be vertically stacked.

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


Last revised on 02 September 2018.