icon-background-square
New
New
Year 10
AQA

Good programming practices

I can explain what is meant by good programming practices and adopt these practices when writing my own code.

icon-background-square
New
New
Year 10
AQA

Good programming practices

I can explain what is meant by good programming practices and adopt these practices when writing my own code.

warning

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

Lesson details

Key learning points

  1. Good programming practice involves taking steps to make your code easier to read and understand.
  2. Variables should always have meaningful identifiers so that the reader of the code understands how they are used.
  3. Comments are used in programs to help make it easier for a programmer to understand what it does.

Keywords

  • Comment - text within source code that is ignored by the compiler or interpreter, used to help programmers understand the code

  • Identifier - the name that a programmer gives to a variable, constant, or subroutine

  • Maintainability - refers to the ease with which maintenance activities can be performed on code, such as correcting errors

Common misconception

Comments are added to code to help you understand your program.

Comments are used to make the code more readable to a programmer who seeks to understand it. The comments should be written in a style that would help them make sense of the program.


To help you plan your year 10 computer science lesson on: Good programming practices, download all teaching resources for free and adapt to suit your pupils' needs...

To extend this lesson, you could get a sample of pupils' code and ask them to annotate the code to identify good and poor practices.
speech-bubble
Teacher tip
equipment-required

Equipment

All pupils require access to devices that can edit and run Python programs. Starter code files are available to copy or use directly via the Raspberry Pi Code Editor.

copyright

Licence

This content is © Oak National Academy Limited (2025), licensed on Open Government Licence version 3.0 except where otherwise stated. See Oak's terms & conditions (Collection 2).

Lesson video

Loading...

6 Questions

Q1.
Match the Python function to its purpose
Correct Answer:input(),takes user input
tick

takes user input

Correct Answer:int(),converts a string to an integer
tick

converts a string to an integer

Correct Answer:lower(),converts text to lowercase
tick

converts text to lowercase

Correct Answer:print(),displays output on the screen
tick

displays output on the screen

Q2.
selection in programming is a selection statement placed inside another selection statement.
Correct Answer: Nested, ested
Q3.
What does the upper() method do when used on a string in Python?
Correct answer: converts all letters to uppercase
converts all letters to lowercase
checks if the string contains numbers
removes spaces from the string
Q4.
How can a program be modified to check more than one username?
use multiple elif statements
store all usernames in a list and check using if username is in list
use a loop to ask for different usernames
Correct answer: all of the above
Q5.
The correct way to ensure case-insensitive username input is: username = input().
Correct Answer: lower(), lower, upper(), upper
Q6.
The expression if score > 10: checks if the score is __________ 10.
less than
greater than or equal to
Correct answer: greater than
equal to

6 Questions

Q1.
Why are good programming practices important?
They make the code run faster.
Correct answer: They make the code easier to read and maintain.
They reduce the number of lines in a program.
They allow variables to store more data.
Q2.
What is the purpose of comments in programming?
to increase the execution speed of a program
to make the program output messages to the user
Correct answer: to explain parts of the code to programmers
to create variables
Q3.
What is snake case, and where is it commonly used?
a type of loop in Python
Correct answer: a naming convention where words are separated by underscores (_)
a function for checking errors in Python
a built-in Python module
Q4.
To make a program easier to understand, you should use variable names instead of single-letter names like x or y.
Correct Answer: meaningful, eaningful
Q5.
Match the good programming practice with its purpose.
Correct Answer:comments,explains parts of the code to other programmers
tick

explains parts of the code to other programmers

Correct Answer:program layout,uses indentation and spacing to improve readability
tick

uses indentation and spacing to improve readability

Correct Answer:identifiers,meaningful variable names to describe stored data
tick

meaningful variable names to describe stored data

Correct Answer:naming conventions,follow standard ways of writing variable names
tick

follow standard ways of writing variable names

Q6.
is the ease with which maintenance activities can be performed on a program, such as fixing errors.
Correct Answer: Maintainability