Lecture 1 (30/01/2024)................................................................................3
What is Python?........................................................................................3
Using Python as a calculator.....................................................................3
Data types................................................................................................4
Boolean values..........................................................................................4
If statements.............................................................................................4
Lecture 2 (06/02/2024)................................................................................4
Value collections.......................................................................................4
Container sequences................................................................................5
Lists.......................................................................................................5
Dictionaries............................................................................................6
Loops........................................................................................................6
Functions...................................................................................................7
Lecture 3 (20/02/2024)................................................................................7
String manipulation...................................................................................7
Membership test operation.......................................................................8
Regular expressions..................................................................................9
Process...................................................................................................9
Metacharacters......................................................................................9
Repeating.............................................................................................11
Match types.........................................................................................11
Grouping..............................................................................................12
Lecture 4 (27/02/2024)..............................................................................12
Text files..................................................................................................12
Opening and closing a text file............................................................13
Functions in a text file..........................................................................13
Organizing and scanning directories/files............................................14
Lecture 5 (05/03/2024)..............................................................................15
Using Python to work with files...............................................................15
Spreadsheets.......................................................................................15
Installing libraries....................................................................................15
1
, Working with openpyxl............................................................................16
Reading files........................................................................................16
Creating an excel file...........................................................................16
Lecture 6 (12/03/2024)..............................................................................17
Csv files...................................................................................................17
Excel file to CSV and the other way around.........................................17
Opening csv files..................................................................................17
Writing csv files....................................................................................18
Json files..................................................................................................18
Opening json files................................................................................18
Writing json files..................................................................................19
Lecture 7 (19/03/2024)..............................................................................19
Important themes during the exam........................................................19
About the exam......................................................................................20
Links to use................................................................................................20
2
, Lecture 1 (30/01/2024)
What is Python?
Python is a programming language. It can do some calculations but is
more than just a regular calculator. It has a certain grammar. If you don’t
use the correct grammar, it will give an error.
Using Python as a calculator
Important to know are:
Operator: these are special symbols that indicate that some sort of
computation should be performed. The operator operates on
values/operands. There are different types of operators:
o Arithmetic operators:
Exponent: **
For example: 2 ** 3 = 8
Modulus/remainder: %
For example: 22 % 8 = 6
Integer division/floored quotient: //
For example: 22 // 8 = 2
Division: /
For example: = 2.75
Multiplication: *
For example: 3 * 5 = 15
Subtraction: -
For example: 5 – 2 = 3
Addition: +
For example: 2 + 2 = 4
o Comparison operators: these values are used to compare
and evaluate down to a single Boolean value.
Equal to: ==
Not equal to: ! =
Less than: <
Greater than: >
Less than or equal to: < =
Greater than or equal to: > =
Value: these are also called operands. This is what the operator
acts on.
Expression: a sequence of operands and operators. This is the total
sum.
Evaluation: reducing the expression down to a single value. This is
the answer you’ll get in the end.
Variables: we can store a value in a variable. It is basically like
saving a (temporary) file, storing it for later. For example: spam =
42. The variable spam now has the integer value 42 in it.
Expression statement: this states that something is something.
3