Introductory Python

purlPURL: https://gxy.io/GTN:P00009
Comment: What is a Learning Pathway?
A graphic depicting a winding path from a start symbol to a trophy, with tutorials along the way
We recommend you follow the tutorials in the order presented on this page. They have been selected to fit together and build up your knowledge step by step. If a lesson has both slides and a tutorial, we recommend you start with the slides, then proceed with the tutorial.

This is an introductory course of Python, as it was taught in Avans Hogeschool in the Netherlands.

This learning path covers all the topics usually taught during our 8 week Python course. Many modules can be re-arranged and re-organised based on the wishes of the instructor, however this is the suggested orientation. They are designed to be as modular as possible.

Week 1: Python is a Calculator

Python can work a lot like a desktop calculator! A lot of mathematical expressions one is used to from maths classes are the same or very similar in Python. Functional notation is also introduced.

Time estimation: 1 hour

Learning Objectives
  • Understand the fundamentals of object assignment and math in python and can write simple statements and execute calcualtions in order to be able to summarize the results of calculations and classify valid and invalid statements.
  • Translate some known math functions (e.g. euclidean distance, root algorithm) into python to transfer concepts from mathematics lessons directly into Python.
  • Understand the structure of a "function" in order to be able to construct their own functions and predict which functions will not work.
Lesson Slides Hands-on Recordings
Python - Math
Python - Functions

Week 2: Python is a Database

Today we introduce basic types (integers, floats, booleans, lists, and dictionaries) that allow you to store data.

Time estimation: 1 hour 30 minutes

Learning Objectives
  • Explain key differences between integers and floating point numbers.
  • Explain key differences between numbers and character strings.
  • Use built-in functions to convert between integers, floating point numbers, and strings.
  • Explain why programs need collections of values.
  • Write programs that create flat lists, index them, slice them, and modify them through assignment and method calls.
Lesson Slides Hands-on Recordings
Python - Basic Types & Type Conversion
Python - Lists & Strings & Dictionaries

Week 3: Python is a Computer

Once you’ve covered basic datatypes, let’s do interesting things with Python like Loops! And Flow Control! Python lets you automate calculations and tasks and we’ll learn about that building block this week.

Time estimation: 1 hour 20 minutes

Learning Objectives
  • Write conditional statements including `if`, `elif`, and `else` branches.
  • Correctly evaluate expressions containing `and` and `or`.
  • Explain what for loops are normally used for.
  • Trace the execution of a simple (unnested) loop and correctly state the values of variables in each iteration.
  • Write for loops that use the Accumulator pattern to aggregate values.
Lesson Slides Hands-on Recordings
Python - Flow Control
Python - Loops

Week 4: Python is a Programming Language

Now that we’ve covered 90% of what you will write when you write a programming language, let’s look at the last 10%, reading and writing files and handling exceptional circumstances.

Time estimation: 1 hour 50 minutes

Learning Objectives
  • catch an exception
  • raise your own exception
  • Read data from a file
  • Write new data to a file
  • Use `with` to ensure the file is closed properly.
  • Use the CSV module to parse comma and tab separated datasets.
Lesson Slides Hands-on Recordings
Python - Try & Except
Python - Files & CSV

Week 5: Recap

You’re now a Python Programmer! This week we’ll go over everything you learned and work on some exercises that require putting together all of your new skills.

Time estimation: 1 hour 30 minutes

Learning Objectives
  • Recap all previous modules.
  • Use exercises to ensure that all previous knowledge is sufficiently covered.
Lesson Slides Hands-on Recordings
Python - Introductory Graduation

Week 6: Python is a Command Line Interface

Here we’ll move into some more advanced topics that will make you a better python programmer!

Time estimation: 45 minutes

Learning Objectives
  • Use glob to collect a list of files
  • Learn about the potential pitfalls of glob
  • Learn how sys.argv works
  • Write a simple command line program that sums some numbers
  • Use argparse to make it nicer.
Lesson Slides Hands-on Recordings
Python - Globbing
Python - Argparse

Week 7: Python is a Workflow Engine

Cont.

Time estimation: 1 hour 45 minutes

Learning Objectives
  • Run a command in a subprocess.
  • Learn about `check_call` and `check_output` and when to use each of these.
  • Read it's output.
  • Set up a Python virtual environment for our software project using `venv` and `pip`.
  • Run our software from the command line.
  • Set up a Conda environment for our software project using `conda`.
  • Run our software from the command line.
Lesson Slides Hands-on Recordings
Python - Subprocess
Virtual Environments For Software Development
Conda Environments For Software Development

Week 8: Review Period

This course is an extremely fast 8 weeks, so this last week is spent on helping students debug problems in-person


Editorial Board

This material is reviewed by our Editorial Board:

orcid logoHelena Rasche avatar Helena RascheBazante Sanders avatar Bazante Sanders

Funding

These individuals or organisations provided funding support for the development of this resource