Building Programs with Python

Self-learning course

Site Updated On: March 01, 2023
For More Info Email: rsginfo@soton.ac.uk
Building Programs with Python

General Information

Requirements: Participants must have access to a computer with a Mac, Linux, or Windows operating system (not a tablet, Chromebook, etc.) that they have administrative privileges on. They should have a few specific software packages installed (listed below).

Accessibility:

We are dedicated to providing a positive and accessible learning environment for all. Please get in touch you require any accommodations or if there is anything we can do to make this lesson more accessible to you.

Contact: Please email or rsginfo@soton.ac.uk for more information.


Surveys

Please be sure to complete this survey after the lesson.

Please input the date as the date you started the materials.

Post-Lesson Survey


Lesson Outline

The best way to learn how to program is to do something useful, so this introduction to Python is built around a common scientific task: data analysis. Our real goal isn’t just to teach you Python, but to teach you the basic concepts that all programming depends on. We use Python in our lessons because: 1. we have to use *something* for examples; 2. it’s free, well-documented, and runs almost everywhere; 3. it has a large (and growing) user base among scientists; and 4. experience shows that it’s easier for novices to pick up than most other languages. But the two most important things are to use whatever language your colleagues are using, so that you can share your work with them easily, and to use that language well.


Schedule

1. Python Basics How do I start the Python interpreter?
What is a variable?
2. Arrays, Lists etc What is a list?
How do I access values in a list?
How to select a range of values from a list?
3. Repeating actions using loops How do I repeat a task?
What is a for loop?
How to iterate over a list?
How to iterate over a range of values?
4. Processing data files How do I open files?
How do I get data out of text?
5. Making choices How do I perform logical operations in Python?
6. Modularising your code using functions What is a function?
Why would I want to use a function?
Where should I put my functions?
7. Handling Errors How can I use an error to understand where my code stopped working?
What types of errors are there in Python?
8. Command-Line Programs How can I run a program from the command line?
Can I tell the program to use different inputs from the command line?
Can I use a python program in a command line pipeline?
9. Reading and analysing Patient data using libraries I work mostly with numerical data are there better methods than strings and lists?
I’ve heard python can be slow when working with big data is there anything I can do about that?
10. Data Visualisation How can I visualise my data?
Can I use python to output plots for papers?
11. Python Style Guide How do I write good-looking python?
12. Survey
13. Challenges
14. Why Python?
Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.


Setup

To participate in this lesson, you will need access to software as described below. In addition, you will need an up-to-date web browser.

The instructions for all the software can be found on the setup page.