CSEC INFORMATION TECHNOLOGY · PROBLEM-SOLVING AND PROGRAMMING · LESSON C6

Coding the Basics: Variables, Input/Output, Selection and Loops

Translating an algorithm into code: declaring variables, input and output, assignment and arithmetic, IF selection, and WHILE and FOR loops, shown in Python with the matching pseudocode.

Sections 7 and 88.48.5≈ 60 min🎮 3 games
Before you start

By the end of this lesson you can…

Step 1 · Watch

Explainer video

5 narrated scenes. Press play, listen and read along — the points appear as they are explained. Use ‹ Prev / Next › or the scene bar to jump to any scene.

LESSON C6 · EXPLAINER

Coding the Basics: Variables, Input/Output, Selection and Loops

Once the plan is ready, coding is translation. The exam is language-independent, but you need to have written real code in one language to show you can do it.

Narration uses your device’s built-in voice. No sound? Switch to “Captions only” — the captions advance on their own.

Explore in 3D

Loops and selection in 3D

Step through a loop and a selection to see how code executes.

Step 2 · Read

Key notes

Copy these into your notebook in your own words — that is how they stick.

input() / print()

Read text / display output.

Type conversion

int(), float() change text to numbers.

Assignment

x = 5 stores a value.

Comparison

== != < > <= >=.

if / elif / else

Selection with indented blocks.

for

Known number of repeats.

while

Repeat while true; update the counter.

Comment

# explains code.

EXAM TIPS & COMMON MISTAKES

  • == compares; = assigns.
  • Indentation is part of Python syntax.
  • Change the loop counter inside a WHILE loop.
  • The exam is language-independent: pseudocode is accepted, but know one language for the SBA.
Play & practise

Games

3 quick games on this lesson. Earn XP and badges as you play — your best score for each game is saved. Games are for practice and do not change your exam readiness. More games in the Information Technology Arcade.

Step 3 · Practise

Paper 1 practice — multiple choice

8 items modelled on real CSEC Paper 1 questions. Choose one answer for each, then check. Aim for 80% or better. Work each item on paper first.

Syllabus 8.4

1. In Python, which function displays output?

Answer: D. print.
Syllabus 8.4

2. Which converts typed text into a whole number?

Answer: A. int().
Syllabus 8.5

3. Which operator compares two values for equality?

Answer: B. Double equals.
Syllabus 8.5

4. Which loop is best when the number of repeats is known?

Answer: C. For loop.
Syllabus 8.4

5. In Python, “%” gives the

Answer: D. Modulus.
Syllabus 8.4

6. Which statement is a comment in Python?

Answer: A. Hash.
Syllabus 8.5

7. What does for i in range(5): do?

Answer: B. Five passes.
Syllabus 8.5

8. A while loop with a condition that never becomes false produces

Answer: C. It never ends.
Step 4 · Apply

Paper 2 practice — structured questions

Write full answers, then reveal the mark scheme and tick the points you earned (9 marks in total). Show all your working — method marks count. Your answers are saved on this device.

Paper 2 style · Coding

Question 1 [9 marks]

Write a program (in a language of your choice or pseudocode) that reads 5 numbers, totals them and prints the average.

(a) (a) Write the statements to declare/initialise the variables used. [2]

MARK SCHEME — (a) (max 2)

(b) (b) Write a loop that reads and adds five numbers. [4]

MARK SCHEME — (b) (max 4)

(c) (c) Write the statements to calculate and display the average. [2]

MARK SCHEME — (c) (max 2)

(d) (d) State why a while loop might never end. [1]

MARK SCHEME — (d) (max 1)

Your progress

Lesson readiness

0%
READY
Not started
Video watched (20%)0%
Multiple choice (40%)0%
Structured (40%)0%

Sources

Where this topic appears in CSEC papers

Find these in your own past-paper booklets for extra timed practice. Items above are written in the style of these papers; any adapted from a specific question say so.