Educator
KS3 Computer Science

Programming in Python

101 questions10 subtopics
Practise all 101 questions free →

What's covered

Functions (Subroutines)11
Parameters and Return Values11
Arithmetic Operators10
Common Python Errors10
Data Types — Integer, Float, String, Boolean10
Input and Output10
Lists and Indexing10
String Operations10
Variables and Assignment10
Comparison Operators9

Key facts

1

In Python the division operator is the forward slash /. 10 / 4 returns 2.5.

2

IndentationError means the indentation (spaces or tabs at the start of a line) is not consistent with the surrounding block.

3

Every comparison in Python returns a Boolean — True or False.

4

Python's bool type stores one of two values: True or False.

5

def add(a, b): return a + badd(2, 3) returns 5.

6

input() does not return an integer by default — it returns a string; conversion is the programmer's job.

7

xs.append(5) adds 5 to the end of the list xs.

8

def double(n): return n * 2double(double(3)) is double(6) = 12.

9

'hello' + ' world' gives 'hello world' because the second string starts with a space character.

10

After x = 7, the value of x is the integer 7 — not zero, not the letter "x", not undefined.

Sample questions

A taste of the 101 questions in this topic — answers marked. Sign up to practise the full set with spaced repetition.

1Arithmetic Operators

What is 10 % 3 in Python?

  • One (the remainder)
  • Ten (the original value)
  • Three (the quotient)
  • Zero (no remainder)
2Common Python Errors

What is a syntax error?

  • Code breaks language rules
  • Program crashes only with certain inputs
  • Program runs but gives wrong output
  • Variable holds an unexpected data type
3Comparison Operators

What does 5 > 3 evaluate to?

  • False
  • Five
  • Three
  • True
4Data Types — Integer, Float, String, Boolean

Name two common Python data types.

  • Integer and string
  • Loop and function
  • Syntax and logic
  • Variable and constant
5Functions (Subroutines)

Why use functions in code?

  • To increase the chance of a syntax error
  • To make the program run more slowly
  • To remove the need for any variables
  • To reuse code and reduce repetition
6Input and Output

What does name = input('your name:') do in Python?

  • Counts how many letters are in 'name?'
  • Prints the word 'name?' and stops
  • Sets a variable to the string 'name?'
  • Shows prompt and reads user input

Try it for four weeks. Free.

One school. Unlimited classes. No card limit. No teacher limit. If your students aren't practising daily by the end of the trial, you owe us nothing.

More KS3 Computer Science topics