← IGCSE Computer Science Paper 1

IDE function: prettyprint

An IDE feature that shows code in a clear layout, using colours for keywords and indentation for blocks, so it is easy to read. It changes only the display, not the code.

Understanding IDE function: prettyprint in IGCSE Computer Science Paper 1

What it does: The indented print line is inside the for loop. Automatic indentation makes this clear at a glance. The colours and layout are only the display. The program text and its output stay exactly the same. Prettyprint is about how the code looks on screen. Translating code is the job of the translator, not prettyprint. Colour-coding keywords, strings and comments makes each part of the code easy to tell apart. A clear layout helps programmers read code and notice mistakes. It does not replace the translator. False. Prettyprint only affects what is displayed in the IDE. The saved code is not changed by the colours.

Common mistakes: The comment is missing its # symbol, so it is treated as code and will not be shown in the comment colour. It should be '# Prettyprint colours comments'. The closing quote is missing, so prettyprint would colour the rest of the line as one string. It should be print("Hello " + name).

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 450–463) and word search (Modules 440–463).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What does prettyprint do in an IDE?
Shows code in a clear layout using colours and indentationTranslates the code into machine code
Matches
Prettyprint rewrites your code so that it runs faster.
↓
Prettyprint only changes the display. It does not change the code or make it run faster.
Applying
Meanings
Term
prettyprint
Meaning
An IDE feature that shows code in a clear layout, using colours for keywords and indentation for blocks, so it is easy to read. It changes only the display, not the code.
Practice
FOR Count ← 1 TO 5
Testing
Gaps
# colours keywords in the editor
Check Answer
Spots
1Prettyprint colours comments
2score = 10

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Seahorse' badge — Range Rider, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What does prettyprint do in an IDE?
A. Shows code in a clear layout using colours and indentation ✓
B. Translates the code into machine code
Prettyprint is about how the code looks on screen. Translating code is the job of the translator, not prettyprint.
2. Prettyprint changes the instructions in a student's program so they run faster.
A. False ✓
B. True
False. Prettyprint only changes the display (layout and colour). The code itself stays exactly the same.
3. In prettyprint, keywords such as IF and WHILE are usually shown...
A. Deleted from the code to save space
B. In a different colour from other text ✓
Colour-coding keywords, strings and comments makes each part of the code easy to tell apart.
4. Which is a benefit of prettyprint?
A. Code is easier to read and errors are easier to spot ✓
B. Code no longer needs to be compiled
A clear layout helps programmers read code and notice mistakes. It does not replace the translator.
5. How does prettyprint show a block of code inside a loop?
A. It puts the block in a separate file
B. It indents the block ✓
Indentation shows which lines belong inside a loop or selection statement, so the structure is clear.

Match the Pairs

if x > 5: print(x) → Prettyprint shows the keyword if in a colour and indents the line inside the block, so the structure is easy to see.
# add the scores → Prettyprint shows a comment in its own colour, so it stands out from the code that runs.
Prettyprint uses indentation to show which lines belong inside a block such as a loop → for i in range(3): print(i)
Prettyprint is layout only: it changes how code looks on screen, not what the code does → print("Hi") # same output with or without colours
Prettyprint rewrites your code so that it runs faster. → Prettyprint only changes the display. It does not change the code or make it run faster.
Prettyprint finds and fixes the errors in your program. → Prettyprint does not fix errors. It only makes the code easier to read so the student can spot errors more easily.

Key Term

prettyprint
An IDE feature that shows code in a clear layout, using colours for keywords and indentation for blocks, so it is easy to read. It changes only the display, not the code.

Fill in the Blanks

1. # prettyprint colours keywords in the editor
Hint: Type the name of the IDE feature that colour-codes keywords and lays out code clearly.
2. if score > 50: print("Pass")
Hint: Type the keyword that starts a selection, which prettyprint would show in a keyword colour.
3. FOR i ← 1 TO 3 OUTPUT i NEXT i
Hint: Type the keyword that closes the loop block, lined up with FOR by prettyprint.
4. # Comments get their own colour print("Hi")
Hint: Type the symbol that starts a comment in Python, which prettyprint shows in its own colour.
5. # Prettyprint changes layout, not the code
Hint: Type the word for what stays exactly the same when prettyprint changes how the program looks.

Spot the Error

Question 1
A Prettyprint colours comments
B score = 10
C if score > 5:
D print("Pass")
Line A — The comment is missing its # symbol, so it is treated as code and will not be shown in the comment colour. It should be '# Prettyprint colours comments'.
Question 2
A name = "Sam"
B print("Hello + name)
C print(name)
Line B — The closing quote is missing, so prettyprint would colour the rest of the line as one string. It should be print("Hello " + name).
Question 3
A for i in range(3):
B print(i)
C if i == 2:
D prnit("Done")
Line D — The function name print is misspelled. Prettyprint colours the real function name, so the misspelling stands out as uncoloured. It should be print("Done").
Question 4
A total = 0
B for n in [1, 2, 3]:
C total = total + n)
D print(total)
Line C — There is a stray closing bracket at the end of the line. A prettyprinted layout makes this easier to spot. It should be ' total = total + n'.
Question 5
A age = 16
B If age >= 16:
C print("Can drive")
Line B — Keywords are case-sensitive, so 'If' would not be shown in the keyword colour. The keyword should be lowercase: if age >= 16:

Student with a class code? Join your class →