Skip main navigation

Comments

As your programs are getting more complex, you may find it more difficult to keep track of what each part of your code does. A way to help you remember …

Comments

As your programs are getting more complex, you may find it more difficult to keep track of what each part of your code does. A way to help you remember …

Do this forever

Using a while loop you can get a computer to continue to do the same task forever, known as an infinite loop. This special type of conditional loop can be …

Looping through a list

You are going to use iteration and lists to create a program which will create and display a shopping list for you. You will create this program in two parts: …

Lists

Python has a data type for storing lists, imaginatively called List. A list can store a sequence of any other pieces of data of any types (integers, strings, booleans, etc.). …

Iterables

You might be thinking … iter-what-ables? That’s OK. An iterable is just something which can be “iterated”, or stepped through one bit at a time, such as a list of …

True or False

Computers make choices by determining if the value of a statement is True or False. This is known as evaluation. If the statement is True then the program will run …

Syntax

Now you are starting to create more complex instructions, it’s time to talk about syntax, the inevitable “syntax errors”, and tips for resolving them. Syntax is a set of rules …

Functions

You have already used some functions in Python, such as print and input. While they are “in-built” and you can’t see their code, they were created in a very similar …

What is abstraction?

Abstraction is the act of removing complexity from a problem by hiding background details and information. Let’s imagine using abstraction to make our Robot wave. To make the Robot wave …

Write your first Python program

The start of every new programming experience is creating a “Hello World” program. It’s one of the simplest programs you can create, and it will put the message “hello world” …

Indentation

Python and indentation are like siblings who always fight. They like each other because they are so closely related, but they are always causing each other problems. Indentation problems are …

If it’s this, then do that

Now that you have an understanding of how to make computers test whether something is true or false, you can use this in your programs using if. When a computer …

What is programming?

There are countless definitions of what computer programming is, but the one I use is: “Programming is how you get computers to solve problems.” There are two key phrases here …

Getting input from the user

So far you have only been using print to output text; your program currently lacks the ability to interact with the user. In this section you will be using input …