Skip to content
Snippets Groups Projects
Commit 604a3eff authored by nyfelix's avatar nyfelix
Browse files

initial commit

parents
No related branches found
No related tags found
No related merge requests found
# Python for Engineers Lecture
This is the root repository of the course python for engineers
## Contents
1. Introduction into programming with python
2. Introduction into IDE and Jupiter Notebooks
3. Basic concepts: Syntax, variables and control structures
4. Basic concepts: Lists and loops
5. Functions
6. Modules and Libraries
7. Tuples, sets, and dictionaries
8. Working with strings
9. Working with files: Introduction to Pandas
10. Numerical Math: Introduction to NumPy
11. Graphs and chars: Introduction to MathPlot
12. Using webservices: Introduction to Requests
13. Object oriented programming in python
## Presentation (for teachers)
Use
Use the following command to start presentaiton of jupiter notebooks:
```
jupyter nbconvert introduction.ipynb --to slides --post serve
```
%% Cell type:markdown id: tags:
# Introduction to Python for Engineers
## Agenda
- [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)
%% Cell type:markdown id: tags:
Where do we start?
Let's do a short Poll to see what you alredy 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
for g in range(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:
## 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 Jupiter Notebook. It combines text / documentation with coding. In every code cell we can execute some python. All cell know of each other. This is a very convenient way 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 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**: And many software systems 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 of this Course
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 scrath 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 programm, A LOT!
* We highly recommend to to give yourself challanges (AI is a good source to find ideas on how you can challange yourselg)
3. Language: This course is in English language
* Most of the documentaiton and examples you find are in English anyway
* We plan to offer this course to incomming exchange students
%% Cell type:markdown id: tags:
## Content of this Course
1. The basics (Week 1-4)
* Working with Jupiter Notebooks and VS-Code
* Python syntax, data types, and control structures, 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
* MathPlot
4. Advanced programming skills (Week 11-14)
* Using webservices
* Object oriented programming with Python
%% Cell type:markdown id: tags:
## About coding and AI in this course
* AI and co-pilots are great tools! I use them a lot for programming, it makes me faster
* At these days, we cannot trust into AI.
* Sometimes it does not understand the problem, your are trying to solve,
* sometimes it just makes things up that 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**
Remark, 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 Vode** as our IDE (most of you should be familiar with this)
* Most of the exercises will be done on Jupiter notebook
* All templates and exercises are deliveres thoroug gitlab:
* We highly encourage you to store your code in a personal git repository!
* This is the way programmers work, and you won't loose 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
*
%% Cell type:markdown id: tags:
## About Jupyter Notebook
* Remark, also this sildes are a jupiter notebook. You will find it here
%% Cell type:markdown id: tags:
## Structure of the Exercises
# The Zen of Python
* Beautiful is better than ugly.
* Explicit is better than implicit.
* Simple is better than complex.
* Complex is better than complicated.
* Flat is better than nested.
* Sparse is better than dense.
* Readability counts.
* Special cases aren't special enough to break the rules.
* Although practicality beats purity.
* Errors should never pass silently.
* Unless explicitly silenced.
* In the face of ambiguity, refuse the temptation to guess.
* There should be one-- and preferably only one --obvious way to do it.
* Although that way may not be obvious at first unless you're Dutch.
* Now is better than never.
* Although never is often better than *right* now.
* If the implementation is hard to explain, it's a bad idea.
* If the implementation is easy to explain, it may be a good idea.
* Namespaces are one honking great idea -- let's do more of those!
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment