TK Study

Software Engineering › Learn step by step › Python, SQL and pseudocode

Item 409 of 426 · Python, SQL, pseudocode and CSS patterns, 16 of 33

Python lists

Code pattern

Jump to a topic
  1. Exam format, question types and command words (46)
  2. Year 11: Programming Fundamentals (69)
  3. Year 11: The Object-Oriented Paradigm (33)
  4. Year 11: Programming Mechatronics (29)
  5. Year 12: Secure Software Architecture (57)
  6. Year 12: Programming for the Web (59)
  7. Year 12: Software Automation (35)
  8. Year 12: The Software Engineering Project (47)
  9. Diagrams and modelling tools (18)
  10. Python, SQL, pseudocode and CSS patterns (33)

See every item in the sequence

Definition

A list stores ordered items: append(), remove(), len(), sorting with sort(), looping, and 2D lists as a list of lists.

Example

grid = [[0]*3 for _ in range(3)]

Found in: syllabus, course specifications, 2025 HSC marking guidelines, school notes, past SDD papers.

Where you'll use it in the test

Syllabus area: Code patterns.

Question types it can appear in

  • Python: Write or complete it in the online Python tool.
  • Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.

Where it has appeared in the paper

The Software Engineering Project (Part A, B, C). Part letters follow each paper’s own layout.

Related past questions

How to use it

A model sentence

General advice, built from the definition and example above

Code pattern: “A list stores ordered items: append(), remove(), len(), sorting with sort(), looping, and 2D lists as a list of lists.” Then apply it: grid = [[0]*3 for _ in range(3)]

In a short answer, give the definition in your own words first, then tie it to the situation in the question. Do not copy the example above unless it fits the scenario.

Official worked answer

Familiarisation Q13 (6 marks): Python: lists, loops, selection (6 marks): official criteria and sample answer

Criteria

6: Substantially correct solution with ALL of: looping correctly; referring to the contents of the data structure correctly; displaying the player's scores and corresponding points as shown; calculating the total points; taking bonus points into account; handling the final round correctly. 5: Most features. 3-4: Some features. 2: One feature. 1: Some understanding.

Sample answer

Input code

scores = [3,5,5,2,1,4,0,1,4,5]

Display the scores and points

Header row

print("Round\tScore\tPoints") totalPoints = 0

Calculate the points and print

for i in range(len(scores)): roundNumber = i + 1 score = scores[i] points = score

# Check if any bonuses apply and NOT the final round
if points == 5 and i != 9:
    # Add the points from the next round as bonus points
    points += scores[i + 1]

# Check if the final round bonus applies
if points == 5 and i == 9:
    # Give the bonus points of 10
    points = 10

# Add to the total points tally
totalPoints += points

# Print the results
print(str(roundNumber) + "\t" + str(score) + "\t" + str(points))

print("\nTOTAL POINTS: " + str(totalPoints))

Open the question page

Go deeper

Check yourself

Write or say the “Python lists” pattern from memory: the syntax and what it does.

Reveal the answer

A list stores ordered items: append(), remove(), len(), sorting with sort(), looping, and 2D lists as a list of lists.

Example: grid = [[0]*3 for _ in range(3)]

Could be tested as: Python, Code reading.