- 1 current stop: learning
- 2 upcoming
- 3 upcoming
- 4 upcoming
- 5 upcoming
Finish after stop 5
Stop 1 of 5 · Post office: sealing a parcel
Trick to keep in mind+3 XP
Many pieces? Collect them in a list and join once.
A str cannot be modified, so text += line allocates a new string and copies all the old characters each time. Over many lines, the copying adds up to a quadratic cost, though some Python builds can hide it. Collecting parts in a list and joining once copies each character a single time, whichever implementation you run.
Read it once, then a question tests whether the trick stuck.