11: Lists in Python

Almost every program needs to be able to store data. Variables are great for storing individual values but it’s often useful to be able to store and process lots of data in a particular order.

Store and use lots of data in the same variable
Lists in python: Store and use lots of data in the same variable

Lists let you store and use lots of data in one variable. This activity explains how to access data stored in a list; how to add and remove data; how to choose something at random from a list and how to sort a list.

Contents:

Page 1: Intro

Page 2: The theory: learn what you need to know as fast as possible.

Page 3: Try it: try out and adapt some working python code snippets.

Page 4: Debug it: Learn how to find and fix common mistakes.

Page 5: Extend it: Choose a project idea to use your newfound python skills.

10: Logic Errors in Python

There are three types of errors that you’ll come across when learning to program in python (or any language): syntax errors, runtime errors and logic errors.

Find and fix common errors in your code
Logic errors in python: Find and fix common errors in your code

Logic errors are often the hardest to find and fix so the aim of this activity is to help you recognize them, debug them and avoid making them wherever possible.

Contents:

Page 1: Intro

Page 2: The theory: learn what you need to know as fast as possible.

Page 3: Try it: try out and adapt some working python code snippets.

Page 4: Debug it: Learn how to find and fix common mistakes.

Page 5: Extend it: Choose a project idea to use your newfound python skills.

09: Selection in Python

There are three main building blocks that all computer programs consist of: sequence, selection and iteration. This activity is designed to help you understand and use selection in python programs.

Tell your code how to make decisions
Selection: Tell your code how to make decisions

Selection means making a choice. You will select different choices hundreds of times every day:

What shall I select to eat for breakfast?

Which selection of clothes shall I wear?

Which people with I select to speak to today (and who will I try to ignore!)

examples of selection in everyday life.

Most programs need to be able to make choices too. You can write code that makes choices by using selection.

Contents:

Page 1: Intro

Page 2: The theory: learn what you need to know as fast as possible.

Page 3: Try it: try out and adapt some working python code snippets.

Page 4: Debug it: Learn how to find and fix common mistakes.

Page 5: Extend it: Choose a project idea to use your newfound python skills.