levo

Problem Solving with Programming

Lists, two-dimensional lists and records

  • 3 things to know
  • Paper 2

Overview

Python lists as arrays, append, insert and del, two-dimensional lists, records as lists of fields, and worked loops over lists of lists.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

How is an array represented in Python?

Key term

What is printed by scores = [12, 15, 9, 20], then print(scores[2])?

Key term

What does scores.append(7) do when scores = [12, 15, 9]?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    How is an array represented in Python?

    Model answer

    Python represents an array as a list, such as scores = [12, 15, 9]. Each item is reached by an index that starts at 0.

  2. 2

    What is printed by scores = [12, 15, 9, 20], then print(scores[2])?

    Model answer

    The code prints 9. Index 2 is the third item because indexes start at 0.

  3. 3

    What does scores.append(7) do when scores = [12, 15, 9]?

    Model answer

    The list becomes [12, 15, 9, 7]. The append() method adds the item to the end.

  4. 4

    What is the list after names = ["Ann", "Bo", "Cy"], then del names[1]?

    Model answer

    The list becomes ["Ann", "Cy"]. The del statement removes the item at index 1.

  5. 5

    Give the list after nums = [4, 8, 12], then nums.insert(1, 6).

    Model answer

    The list becomes [4, 6, 8, 12]. The insert() method places 6 just before the item at index 1.

  6. 6

    What is printed by print(len([3, 6, 9, 12, 15]))?

    Model answer

    The code prints 5. The len() function counts the items in the list.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Computational Thinking
Data
Computers
Networks

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

The check is 45 + 27 = 72.
denarybinaryhexadecimal

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

AA normal test value is 14.
BA boundary test value is 16.
CAn erroneous test value is 20.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

A kibibyte (KiB) is 1,024 bytes. The figure 1,024 is 2¹⁰.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Problem Solving with Programming, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.