GCSE · Computer Science · Eduqas · Spec C500QS
Statement completion
One missing letter and a whole program stops. Watch it happen, then watch an editor that would have finished the word for you.
Computer Science · Programming tools
One missing letter
This program was typed by hand, every letter. Press Run and see what happens. Then switch statement completion on and Run it again.
- prices = [4, 12, 7]
- total_cost = 0
- for price in prices:
- total_cost = total_cost + price
- answer = total_cos
- print(answer)
Python. Each error message is the real one Python gives, shortened: Python's extra “Did you mean…?” hint is left out. The editor behaviour is illustrated, not live.
Computer Science · Programming tools
Would the editor suggest it?
Picture a Python program that already defines the variables prices and total_cost and a subroutine called reset_sum. The programmer starts typing a new word. Would the editor suggest each of these words?
The programmer has typed re. What would the editor do with each word?
Still to sort
Suggested: a keyword (0)
A word that is part of the language itself, such as return or while.
Where the line is: It has to be a keyword and match the characters typed so far.
Suggested: a name already defined (0)
A variable or subroutine name the programmer has already created in this program.
Where the line is: It has to be a name this program defines and match the characters typed so far.
Not suggested (0)
It does not match the characters typed so far.
Where the line is: A keyword or a defined name can still be left out: it also has to match what has been typed.
The editor can draw on the language's keywords and on names you have already defined. What you have typed so far decides which of them are offered.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
The editor that finishes your words for you, so you type less and misspell less
What you need to know
- Statement completion is a tool that a program development environment gives you to help you write code.
- As you type, it suggests keywords, names or statements that match the characters typed so far.
- Type more characters and fewer suggestions still match, so the list narrows.
Have a goZara is certain that typing MORE letters makes the suggestion list longer. She has never been more confident. Is she right?
No. More characters means fewer suggestions still match, so the list gets shorter.
Every extra character is one more thing a suggestion has to match, so words that no longer match drop out.
- Accept a suggestion and the environment fills in the rest of the keyword, name or statement for you.
- Names you have already defined can be suggested too, such as variable or subroutine names, alongside the language's keywords.
Have a goYour program defines a variable called total_cost and you type tot. Could the environment offer total_cost, or only keywords?
It could offer total_cost, because names you have defined can be suggested as well as keywords.
Suggestions are not limited to the language's keywords: they can include the names your own program defines.
- Saving typing is the first benefit: you do not type every word in full, so code is written more quickly.
- Correct spelling is the second benefit: the environment fills in spellings correctly, so spelling mistakes that would cause errors are avoided.
- The catch: it only suggests and fills in matching words. It does not check that your program does what you intend.
Have a goA loop adds price minus 1 instead of price. Every name is spelt correctly. Would statement completion have caught it?
No. It only suggests and fills in matching words; it does not check what the program does.
Correct spelling is not the same as correct logic: completion helps with the first and says nothing about the second.
The big picture
Statement completion is a tool in a program development environment. As you type, it suggests keywords, names or statements that match the characters so far, and it fills in the rest when you accept one. That saves typing and gets spellings right. It does not check what your program does.
Key points
Worked example
Problem
Earlier in a program you defined a variable called high_score. On a new line you want to use it. Show how statement completion gets the name onto the line.
⚠ Watch out
Thinking statement completion checks or fixes your program. It only suggests and fills in matching words, so it can stop a spelling slip in a word it fills in but not a wrong calculation.
Memory hook
Type a bit, accept, done. Fewer keys pressed, fewer typos made.
Check yourself
Cover the page and say it out loud: what appears as you type, what happens when you accept, the two ways it helps, and one thing it does not do.
Flashcards
(9)What is statement completion?
What does the environment do as you type with statement completion?
What happens when you accept a suggestion?
What can be suggested apart from the language's keywords?
How does statement completion save time?
How does statement completion help with spelling?
Does statement completion fix a program that adds the wrong value?
What is the difference between a keyword and a defined name in a suggestion?
You type more characters. What happens to the suggestions?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore Eduqas GCSE Computer Science topics
How this lesson was checked. This Eduqas GCSE Computer Science (specification C500QS)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 15 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.