Beginner learning guide
How to start learning Python: predict, change, explain
A beginner Python guide with a worked score example, a simple loop, a practice exercise, and answers.
By AI Ka School4 min readFor students ages 8–17
The short answer
How should a beginner start learning Python?
Start with short programs that display text and update a number. Predict the output before checking it, change one value, and explain why the output changed. Then practise decisions and loops. You do not need to memorise every command before making something small.
1. Read a program one line at a time
A program is a set of instructions. In this example, score refers to a number. The second line calculates a new value using the old value, then assigns the result to score. print() displays the result.
Read from top to bottom and write down what score means after each line. This is called tracing. You can practise tracing on paper before using a Python environment.
score = 3
score = score + 4
print(score)Output
72. Change one thing and make a prediction
Change the starting score to 8. Before checking, write your prediction: the result should be 12. Now change the number added from 4 to 2. What changes and what stays the same?
Keep a tiny notebook with three columns: my change, my prediction, and what happened. When a prediction is wrong, explain the mismatch. That explanation is useful evidence of what you need to practise next.
3. Repeat a small action
A for loop can repeat instructions for a sequence of values. range(3) produces 0, 1, and 2. The ending value 3 is excluded. The indented line belongs to the loop.
for step in range(3):
print(step)Output
0
1
2- Predict the output for range(2).
- Change the displayed value to step + 1.
- Explain why the output now starts at 1.
4. Use a short practice routine
Choose one concept for a session. Read a worked example, cover the answer, and attempt a similar problem. Finish by writing one sentence about the idea in your own words.
For your next session, try the earlier problem again before reading your notes. If it is difficult, use a hint and then try a new example. A small quiz project can combine a score variable, a decision, and repeated questions.
Your turn
A program runs score = 2, then score = score + 3, then score = score * 2. What does print(score) display?
Make your prediction before opening the answer.
Show a hint
Write down the value after each assignment. The last line doubles the updated score.
Check your answer
10. The values are 2, then 5, then 10. It does not calculate 2 + 3 * 2 in one expression; each assignment happens in order.
Words to know
- Variable
- A name that refers to a value in a program.
- String
- Text, usually written inside quotation marks in Python code.
- Loop
- A way to repeat a group of instructions.
- Debugging
- Finding and fixing the cause of a program behaving differently from what you expected.
Sources and further reading
The examples and exercises are written for this guide. Use these original references to explore the underlying concepts.
- Python documentation: numbers, text, and assignment
Reference for values, assignment, and print().
- Python documentation: for statements and range()
Reference for the loop example and its excluded end value.