Quiz — Lecture 10

Section A from memory, one line each. Section B shows your reasoning - marks are for method, not final answers. Answers are discussed in class; the exit ticket goes on a card.

Section A

A1. What is s[-1] in Python?

A2. Why can't you assign s[0] = 'X'?

A3. Name the normalisation steps before comparing user text.

A4. How much memory does an 'ends with digit' check need?

Section B

B1. Classify 'ab1', 'abc', 'a1c' under: must start with a letter, must end with a digit.

B2. Fill the template 'Dear {name}, your {item} is ready.' for name=Bo, item=parcel - what does the code split on?

Exit ticket

Answer one of these on your card in 60 seconds (choose any one):

  1. Why normalise before comparing strings?
  1. What does immutability of strings imply for building output?
  1. When is slicing clearer than a loop?

Homework