Mathematical operations in data structures
I can perform a range of mathematical operations on list items and return a result.
Mathematical operations in data structures
I can perform a range of mathematical operations on list items and return a result.
These resources will be removed by end of Summer Term 2025.
Lesson details
Key learning points
- Mathematical operations can be performed using operators in Python.
- Mathematical operations can be performed on individual list items.
- The shuffle() function can be used to randomly reorder the contents of a list.
Keywords
Operator - a symbol or word that instructs the computer to perform a specific calculation or action
List - a collection of data in a particular sequence
Common misconception
Mathematical operations cannot be performed on items held in a list; the items must first be stored in a new variable.
Mathematical operations can be performed directly on list items by using an index value to reference the value used.
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 Foundation's Code Editor.
Licence
Starter quiz
6 Questions
a collection of characters
able to be changed
the location of an item in a list
Exit quiz
6 Questions
a symbol or word that instructs the computer to perform a calculation
a collection of data in a sequence
randomly reorder the contents of a list
a collection of characters
not able to be changed