Lists

Computer Science: KS3, topic 2.1.16

Lists

Lists are a data structure quite similar to an array.

Lists

Lists

  • Lists store multiple elements of different data types under the same identifier.
  • There can be a variable number of elements - they never get full.
Lists in pseudocode

Lists in pseudocode

  • A list can be declared as follows:
  • pupils = []
  • Values can be added to the end of the list as follows:
  • pupils.append("Alice")
  • Values can be accessed as follows:
  • print("The first student is " + pupils[0])

Test yourself on Lists

  • Which of these are true of lists?

  • How is a list created?

Practise this topic for free