Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the appendix entitled GNU Free Documentation License.
In 1989, the Dutch programmer Guido van Rossum created the programming language, Python. Due to its simple implementation and readable nature, Python has become a widely-used language that attracts both beginner and advanced programmers alike. In addition to its easily understood syntax, Python is also free and can be easily installed. These aforementioned attributes make it a great alternative to Matlab and other costly software platforms.
It is important to note that Python 3.x, which was recently released in 2008,
cannot successfully use interfaces and data from its predecessor Python 2.x
that is Python 3.x. In this tutorial, we will be using Python 3.6, which is
the newest version of Python 3.x. The reason for doing so is python plans to
definitively end Python 2.7, which is final and last version of python 2.x, by
2020, as it is encouraging everyone to make the switch to Python 3.x.
You can check the version of python that you are running on your system by
running python --version
Python is a very popular high-level general-purpose programming language. As
an interpreted language, code does not need to be compiled and can be run on
any system where an interpreter is available. The core language is Free and
Open-Source Software (FOSS), and can be acquired and used at no cost. There is
a very large library of routines available, including ones specifically
designed for scientific computing, such as SciPy or NumPy.
There are a number of integrated development environments (IDEs) available for
Python, many of which would be quite good for this course. We are recommending
the use of Spyder, a free IDE,
which includes a number of
matlab-like features that make
it especially useful for modeling and simulation use. In addition, you will
need to download and install an interpreter; we recommend
Anaconda, which is
available for Mac, Linux, and Windows at
https://www.continuum.io/downloads and which provides a bundle of scientific programming packages
in the base installation (including Spyder).
Python was conceptualized in the late 1980s by Guido van Rossum who worked
that time in a project at the CWI (Centrum Wiskunde & Informatica, Amsterdam,
Netherlands). The name
"Python" came to his mind in December 1989, when he called his 'hobby'
programming project that kept Guido occupied during the week around Christmas.
There are many good reasons to choose Python as your primary programming
language. First of all Python is an easy to learn, powerful programming
language. Furthermore it has efficient high-level data structures, which allow
you to write complex operations in fewer statements than in C, C++ or Java.
Object-oriented programming is a lot easier than in languages like Java.
Guido van Rossum, the author of Python, when asked, what features of Python he
is most pleased with, answered in an interview with Linux Journal: "The feel
of the whole system suits my style of programming well, for obvious reasons.
The ability to run the interpreter interactively and the ability to write code
from the bottom up and test it piecemeal combine to let me write code quickly.
Other people find that it makes them more productive, too."
Python has become one of the most popular programming languages among
developers and programmers. They praise it for its clean syntax and code
readability. Python is a general-purpose high-level programming language.
Python is both object oriented and imperative and it can be even used in a
functional style as well. Python programs are portable, i.e. they can be
ported to other operating systems like Windows, Linux, Unix and Mac OS X, and
they can be run on Java and .NET virtual machines. Python is very fast. The
source code is compiled into bytecode, so that executing the same file will be
faster, if the script will be executed again. The bytecode is an
"intermediate language," which is said to run on a virtual machine that
executes the machine code corresponding to each bytecode.
The Python Standard Library contains an enormous number of useful modules and
is part of every standard Python installation. After having learned the
essentials of Python, it is necessary to become familiar with the Python
Standard Library because many problems can be solved quickly and easily
if you are acquainted with the possibilities that these libraries offer.
The purpose of this tutorial is to not only allow you to familiarize yourself
with python but also to gain a better understanding of computer science. In
addition, I hope you, the reader, is able to understand the power of Python as
a means of solving a variety problems. Throughout this tutorial, I hope to
explain the basic syntax and functions that make up the python standard
library. Specific topics that will be covered include: indentation, typing,
mathematics, expressions, methods, and statements.