Making Decisions

Overview


In this first part of the course, you start writing Python and learn how to make programs that react to information. You will print messages, ask the user questions, store values in variables, work with text and numbers, and use conditions to make different things happen in different situations.

There is a second goal running alongside the first one. From the beginning of the course, you will practise reading, tracing, and explaining code. In addition to producing code, a programmer also needs to be able to look at a program, work out what it does, explain why it behaves how it behaves, and decide whether its behavior matches the intended purpose.

After working through this part, you should be able to write, trace, test, and explain small programs that work with values and make decisions.

The structure of this part is as follows:

  • Programs and the Programming Workflow introduces programming as problem solving and shows the basic edit-run-observe-revise workflow.
  • Talking with a Program introduces print(...), input(...), strings, and small interactive programs.
  • Values, Variables, and Types develops the idea that a running program has state, that values have different types, and that input text can be converted when a number is needed.
  • Numbers and Expressions applies those numeric conversions while introducing arithmetic and translating small calculations into Python.
  • Making Decisions introduces comparisons and if, elif, and else, followed by simple ways to combine conditions.
  • Reading, Tracing, and Explaining Programs brings the ideas together and practises checking explanations, including AI-generated ones, against the code.
  • Decisions and Games looks at using variables and decisions in a larger program with some unfamiliar code. You modify the rules of a small graphical game while leaving the framework code alone.
  • Recap and Feedback reviews the part, asks you to complete a parcel-delivery program, and collects feedback on your experience.

Background Survey

0 / 5 points

Before starting the course, please answer the short background survey below. It helps us understand the backgrounds of students taking the course, improve the course, and examine whether students with different backgrounds are supported equitably.

Your responses will not affect your grade. You may skip any question or select “Prefer not to answer”.

A useful rhythm for this part is:

  1. complete the background survey above;
  2. read each chapter in order;
  3. type and run the examples rather than only reading them;
  4. complete the exercises as you go;
  5. when an exercise asks for a prediction, make the prediction before answering;
  6. finish with the recap and feedback.

Before moving on from a chapter, use its exercises to check that you can apply the ideas. Return to the examples when a result differs from your prediction.

The most important working habit in this part is simple:

Predict first. Run second. Explain what happened.

That habit will keep paying off for the rest of the course.