Hans-Petter Halvorsen

Python is an open source and cross-platform programming language, that has become increasingly popular over the last ten years. It was first released in 1991. Latest version is 3.8.x. CPython is the reference implementation of the Python programming language. Written in C, CPython is the default and most widely-used implementation of the language.

Python is a mult-purpose programming languages (due to its many extensions), examples are scientific computing and calculations, simulations, web development (using, eg., the Django Web framework), etc.

The programming language is maintained and available from (Python Software Foundation):

Here you can download the basic Python features in one package, which includes the Python programming language interpreter, and a basic code editor, or an integrated development environment, called IDLE.

See the following video to get a short introduction to Python:

Read the following textbooks for more information about Python (just click the cover images below in order to open and download):

ISBN: 978-82-691106-4-7

This is a textbook in Python Programming with lots of Practical Examples and Exercises. You will learn the necessary foundation for basic programming with focus on Python. This textbook is written in LaTeX.

You find Source Code and additional Examples below.

Below you find videos explaining and complements the different Python topics and examples within the textbook:

Introduction to Python (YouTube) + PowerPoint (PDF)

Basic Python Programming (YouTube) + PowerPoint (PDF)

Python Programming (YouTube) + PowerPoint (PDF)

Plotting with Programming (YouTube) + PowerPoint (PDF)

Create Functions with Python (YouTube) + PowerPoint (PDF)

File Handling in Python (YouTube) + PowerPoint (PDF)

Mathematics in Python (YouTube) + PowerPoint (PDF)

Create Classes in Python (YouTube) + PowerPoint (PDF)

You find also all the videos above in this YouTube Playlist (Python Programming)

Not all resources are ready at the moment, but new resources are released continuously. Stay tuned!

ISBN: 978-82-691106-5-4

This is a textbook in Python Programming with lots of Examples, Exercises, and Practical Applications within Mathematics, Simulations, etc. The focus is on numerical calculations in mathematics and engineering. Necessary theory is presented in addition to many practical examples. This textbook is written in LaTeX.

You find Source Code and additional Examples below.

Below you find videos explaining and complements the different Python topics and examples within the textbook:

**Mathematics and Science:**

Solving Linear Equations with Python (YouTube) + PowerPoint (PDF)

Interpolation in Python (YouTube) + PowerPoint (PDF)

Curve Fitting in Python (YouTube) + PowerPoint (PDF)

Least Square Method in Python (YouTube) + PowerPoint (PDF)

Optimization in Python (YouTube) + PowerPoint (PDF)

Linear Algebra in Python (YouTube) + PowerPoint (PDF)

Differential Equations in Python (YouTube) + PowerPoint (PDF)

Numerical Differentiation in Python (YouTube) + PowerPoint (PDF)

Numerical Integration in Python (YouTube) + PowerPoint (PDF)

**Simulations:**

Discrete Systems with Python (YouTube) + PowerPoint (PDF)

Mass-Spring-Damper System with Python (YouTube) + PowerPoint (PDF)

**DAQ:**

DAQ with Python (YouTube) + PowerPoint (PDF)

DAQ with I/O Modules in Python (YouTube) + PowerPoint (PDF)

Sensors and Actuators with Python (YouTube) + PowerPoint (PDF)

TMP36 Temperature Sensor with Python (YouTube) + PowerPoint (PDF)

Thermistor Temperature Sensor with Python (YouTube) + PowerPoint (PDF)

Light Sensors with Python (YouTube) + PowerPoint (PDF)

Push Buttons with with Python (YouTube) + PowerPoint (PDF)

**Other Topics:**

Python with Jupyter Notebook (YouTube) + PowerPoint (PDF)

You find also all the videos above in this YouTube Playlist (Python for Science and Engineering)

Not all resources are ready at the moment, but new resources are released continuously. Stay tuned!

This is a textbook in Python Programming with lots of Examples, Exercises, and Practical Applications within Mathematics, Simulations, Control Systems, DAQ, Database Systems, etc. The focus is on the use of Python within measurements, data collection (DAQ), control technology, both analysis of control systems (stability analysis, frequency response, ...) and implementation of control systems (PID, etc.). Required theory is presented in addition to many practical examples and exercises in Python. This textbook is written in LaTeX.

**This textbook is available as an "Early Preview" edition.**

You find Source Code and additional Examples below.

Below you find videos explaining and complements the different Python topics and examples within the textbook:

Python for Control Engineering (YouTube) + PowerPoint (PDF)

Transfer Functions with Python (YouTube) + PowerPoint (PDF)

State Space Models with Python (YouTube) + PowerPoint (PDF)

Frequency Response with Python (YouTube) + PowerPoint (PDF)

Stability Analysis of Control Systems with Python (YouTube) + PowerPoint (PDF)

Control Systems with Python (YouTube) + PowerPoint (PDF)

Control Systems with Python - Part 2 (YouTube) + PowerPoint (PDF)

You find also all the videos above in this YouTube Playlist (Python for Control Engineering)

Not all resources are ready at the moment, but new resources are released continuously. Stay tuned!

This is a textbook in Python Programming with lots of Examples, Exercises, and Practical Applications within Software Systems, Software Development, Software Engineering, Database Systems, Web Application Desktop Applications, GUI Applications, etc. The focus is on the use of Python for creating modern Software Systems. Required theory is presented in addition to many practical examples and exercises in Python. This textbook is written in LaTeX.

**This textbook is available as an "Early Preview" edition.**

You find Source Code and additional Examples below.

Python for Software Development (YouTube) + PowerPoint (PDF)

Python with Visual Studio (YouTube) + PowerPoint (PDF)

Python Integration with LabVIEW (YouTube) + PowerPoint (PDF)

**GUI/Desktop Programming:**

Python PyQt GUI Development (YouTube) + PowerPoint (PDF)

**Database Development:**

Python and SQL Server (YouTube) + PowerPoint (PDF)

Python and MongoDB (YouTube) + PowerPoint (PDF)

Python and MySQL (YouTube) + PowerPoint (PDF)

**Raspberry Pi:**

Raspberry Pi (YouTube) + PowerPoint (PDF)

Raspberry Pi with Python (YouTube) + PowerPoint (PDF)

Raspberry Pi GPIO with Python (YouTube) + PowerPoint (PDF)

Raspberry Pi using SPI and I2C with Python (YouTube) + PowerPoint (PDF)

Raspberry Pi and CircuitPython (YouTube) + PowerPoint (PDF)

**micro:bit:**

micro:bit and Python (YouTube) + PowerPoint (PDF)

**Web Programming:**

Web Development using Python Django (YouTube) + PowerPoint (PDF)

You find also all the videos above in this YouTube Playlist (Python for Software Development)

Not all resources are ready at the moment, but new resources are released continuously. Stay tuned!

This is a textbook where you learn about Raspberry Pi and Python Programming with lots of Examples, Exercises, and Practical Applications. The focus is on the use of Python in combination with Raspberry Pi. Required theory is presented in addition to many practical examples and exercises in Python. This textbook is written in LaTeX.

**This textbook is available as an "Early Preview" edition.**

You find Source Code and additional Examples below.

Raspberry Pi (YouTube) + PowerPoint (PDF)

Raspberry Pi with Python (YouTube) + PowerPoint (PDF)

Raspberry Pi GPIO with Python (YouTube) + PowerPoint (PDF)

Raspberry Pi using SPI and I2C with Python (YouTube) + PowerPoint (PDF)

Raspberry Pi and CircuitPython (YouTube) + PowerPoint (PDF)

You find also all the videos above in this YouTube Playlist (Raspberry Pi and Python)

Not all resources are ready at the moment, but new resources are released continuously. Stay tuned!

**Note!** These are "working documents" that are more or less updated continuously with new contents. See the Questions and Comments section if you have questions, if you find bugs or want new topics, examples, etc.

Below you find lots of resources regarding Python.

Python Code Examples - From the Textbooks above.

Here are some Python Tutorials:

- The official Python Tutorial (3.7)
- The official Python Documentation (3.7)
- Python Tutorial (w3schools.com)

Rather than having all of its functionality built into its core, Python was designed to be highly extensible. This approach has advantages and disadvantages. An disadvantage is that you need to install these packages separately and then later import these modules in your code.

These packages need to be downloaded and installed separately, or you choose to use, e.g., a distribution package like **Anaconda**.

Some important packages are:

- NumPy - NumPy is the fundamental package for scientific computing with Python
- SciPy - SciPy is a free and open-source Python library used for scientific computing and technical computing. SciPy contains modules for optimization, linear algebra, integration, interpolation, special functions, FFT, signal and image processing, ODE solvers and other tasks common in science and engineering.
- matplotlib - Matplotlib is a Python 2D plotting library

Lots of other packages exists, depening on what you are going to solve.

Anaconda includes Python, the Jupyter Notebook, and other commonly used packages for scientific computing and data science.

They offer a free version (Anaconda Distribution) and a paid version (Enterprise)

Anaconda is available for Windows, macOS, and Linux

Wikipedia: https://en.wikipedia.org/wiki/Anaconda_(Python_distribution)

**Spyder** and the Python packages (NumPy, SciPy, matplotlib, ...) mention above +++ are included in the Anaconda Distribution.

An Editor is a program where you create your code (and where you can run and test it). Most Editors have also features for Debugging.

For simple Python programs you can use the IDLE Editor, but for more advanced programs a better editor is recommended.

Examples of Python Editors:

Spyder is an open source cross-platform integrated development environment (IDE) for scientific programming in the Python language.

Web: **https://www.spyder-ide.org **

Wikipedia: https://en.wikipedia.org/wiki/Spyder_(software)

Spyder is included in the Anaconda Distribution.

Visual Studio Code is a multi-purpose source code editor developed by Microsoft for Windows, Linux and macOS.

Web: https://code.visualstudio.com

Resources:

Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs, as well as websites, web apps, web services and mobile apps. The deafult (main) programming language in Visual studio is C#, but many other programming languages are supported.

Visual studio is available for Windows and macOS.

Visual Studio (from 2017), has integrated support for Python, it is called "Python Support in Visual Studio".

Web: https://visualstudio.microsoft.com

Wikipedia: https://en.wikipedia.org/wiki/Microsoft_Visual_Studio

LabVIEW is a graphical programming language well suited for hard-ware integration, taking measurements and data logging.

Go to my LabVIEW page in order to learn more about LabVIEW.

Download Python Integration in LabVIEW Examples

MATLAB is a tool for technical computing, computation and visualization in an integrated environment. MATLAB is an abbreviation for MATrix LABoratory, so it is well suited for matrix manipulation and problem solving related to Linear Algebra, Modelling, Simulation and Control applications, etc...

Go to my MATLAB page in order to learn more about MATLAB.

Software Development and Enginnering Resources

Database Systems, Structured Query Language

Visual Studio and C# programming resources

Industrial IT resources