-[An Example of a Python Program](#an-example-of-a-python-program)
-[Background and History of Python Programming Language](#background-and-history-of-python-programming-language)
-[About this Course](#about-this-course)
-[Lesson 1: Introduction to Jupyter Notebook](#lesson-1)
%% Cell type:markdown id: tags:
# Where do we start?
Let's do a short Poll to see what you already know about Python.
1. I have never used Python before.
1. I have used Python before, but I am not very familiar with it.
1. I have used Python before and I am somewhat familiar with it.
1. I am a Python expert.
%% Cell type:markdown id: tags:
# An Example of a Python Program
Below you see an example of a Python program.
If you are used to other programming languages, this looks a bit different... but you'll get used to it!
%% Cell type:code id: tags:
``` python
print('Python is fun!')
```
%% Output
Python is fun!
%% Cell type:code id: tags:
``` python
forginrange(3,0,-1):
print(g)
```
%% Output
3
2
1
%% Cell type:markdown id: tags:
As you can see Python is easy to read, almost like English. You will learn more about the Python syntax later on.
%% Cell type:markdown id: tags:
# Background and History of the Python Programming Language
%% Cell type:markdown id: tags:
## Why Python?
Python is a very popular programming language for a variety of reasons
***Readability and Simplicity**: Python has a clean and readable syntax, which makes it easy to learn and understand.
***Versatility**: Python is a general-purpose language, meaning it can be used for a wide range of applications, from web development to data analysis, machine learning, automation, and more. (e.g., our PLM System "CIM Database" is written in Python)
***Large Standard Library**: Python comes with a vast standard library that provides modules and functions for many common tasks, reducing the need for external libraries.
***Extensive Ecosystem**: There is a rich ecosystem of third-party libraries and frameworks that extend Python’s capabilities across different domains.
***Community Support**: Python has a large and active community, which means extensive documentation, a wealth of tutorials, and community-contributed packages are readily available.
***Cross-Platform Compatibility**: It can run on various operating systems like Windows, macOS, and Linux without modification.
***Data Science and Machine Learning**: Python has become the go-to language for data science and machine learning, largely due to libraries like NumPy, Pandas, Scikit-learn, and TensorFlow.
%% Cell type:markdown id: tags:
## Background and History of Python Programming Language
Let's trace the roots of this programming language
* https://www.youtube.com/watch?v=Tm5u97I7OrM
* https://www.youtube.com/watch?v=ucD_1ryKKm0
* https://www.youtube.com/watch?v=J0Aq44Pze-w
%% Cell type:markdown id: tags:
## Different Ways to use Python
***Python in "Jupiter Notebooks"**: This slide you see is a document, called Jupyter Notebook. It combines text / documentation with coding. In every code cell we can execute some Python. All cells know of each other. This is a very convenient way to do data analytics, since you can explain your thoughts, run your code, and visualize the results at the same place.
***Standalone Python Applications**. You write your code in an IDE such as VS-Code and execute it. There are many different types of applications, such as web-applications, command line applications, or applications with a user interface that runs on your operating system.
***Micro-Python**: This is a subset of Python to write code that runs on micro-controllers. This is becoming more and more popular for prototyping IoT applications. However, in terms of speed, it cannot compete with C/C++.
***Python Scripting**: Many software systems also use Python as a scripting language to enhance its functionality (like our PLM solution at OST, or AWS Lambda Functions)
%% Cell type:markdown id: tags:
# About this Course
%% Cell type:markdown id: tags:
## Some Comments Upfront
1. The goal of this course is a dedicated introduction to the programming language for engineers
* Basic usage of the language
* Crunching data and connecting from different sources
* Dealing with math and visualization
2. With 2 ECTS we can only scratch at the surface
* We will give you a lot of hints where you can do a deep dive yourself
* If you want to become a programmer: you need to program, A LOT!
* We highly recommend to give yourself challenges (AI is a good source to find ideas on how you can challange yourself)
3. Language: This course is in English language
* Most of the documentation and examples you find are in English anyway
* We plan to offer this course to incoming exchange students
%% Cell type:markdown id: tags:
## Content of this Course
1. The basics (Week 1-4)
* Working with Jupyter Notebooks and VS-Code
* Python syntax, data types, control structures, and loops
* Functions, namespaces, and libraries
2. Working with data (Week 5-7)
* Extended list types: dictionary, tuples, sets
* Crunching strings
* Reading and writing files
3. Dedicated libraries for engineers (Week 8-10)
* Pandas
* NumPy
* Matplotlib
4. Advanced programming skills (Week 11-14)
* Using webservices
* Object oriented programming with Python
You will find all required links on Moodle. And all lecture notebooks can be accessed here:
* AI and co-pilots are great tools! I use them a lot for programming, it makes me faster
* These days, we cannot trust AI.
* Sometimes it does not understand the problem, you are trying to solve,
* sometimes it just makes things up that do not exist
* AI has become a problem in cyber security
* Thus, AI is only a helpful tool, if you can understand the output of it
* When using AI, make sure you know what you are doing.
**If you are new to a langugage don't use co-pilots. You need to get familiar with the syntax and you need to figure out how to use the language yourself**
Note: This Video explains very well, what you should consider when learning Python, and how to use/not use AI/Co-Pilots: https://www.youtube.com/watch?v=St48epdRDZw
%% Cell type:markdown id: tags:
## Our Development Environment
* In this course we use **Visual Studio Code** as our IDE (most of you should be familiar with this)
* Most of the exercises will be done on **Jupyter Notebook**
* All templates and exercises are delivered through **gitlab**: https://gitlab.ost.ch/edu-public/python-for-engineers/pyeng-exercises
* We highly encourage you to store your code in a personal ***git repository***!
* This is the way programmers work, and you won't lose your code
* If you want support, this is the best way to share code with us (I will not accept python files via email)
* For those who don't know git, go here: https://www.youtube.com/watch?v=r8jQ9hVA2qs
* In class we are working with **Python version 3.7**
* Feel free to use your own device and upgrade to version **3.12**. However, we will not support or assist with private installations.
%% Cell type:markdown id: tags:
# Lesson 1: Introduction to Jupyter Notebook
%% Cell type:markdown id: tags:
## About Jupyter Notebook
* As mentioned before Jupyter Notebooks are a great way to program, explain, document and present results all in one place.
* Jupyter notebook is a fusion of two very fundamental technologies
* Markdown: A simple notation convention to create formatted text using a plain text editor
* Python: Our programming language
* In short jupyter notebook is a simple file with the ending .ipynb
* Visual Studio Code (or in Jupyterlab, which is another tool work with Jupyter notebooks) help you make these files interactive
* Inside these files we can create blocks
* Markdown blocks to write text
* Python blocks to write code
* Each Python block is followed by an output block where we see the results of the python code.
%% Cell type:markdown id: tags:
## Let's Create our First Notebook
**The image is not displaying correctly on my machine because it is missing in repository. ensure that the image is added**