I was introducing lists to someone young (in Scratch). Creating a list is boring, so I opted to introduce something that you can do with lists, but requires some thinking: swapping. I introduced it by putting out four pencils in a row, like this. I asked them to swap the second and fourth items in the array (in reality).
| | | |
They took both their hands, picked up the second and fourth pencils (each in one hand), and swapped them! That works in reality... but isn't right in computer science. So, I told them, try doing it with only one hand. Predictably, they couldn't. I introduced a temporary spot, where they could put one pencil. I was hoping they would do something like this:
Second Item -> Temp spot
Fourth Item -> Second spot
Temp spot -> Fourth spot
They figured it out. But they asked me something like this: "Why can't I use two hands?". I wasn't sure how to answer that. The obvious answer is... the computer only has one hand (this was Scratch, so multithreading didn't exist). But... I'm hesitant to say that for two reasons: (1) in Python, the "two-hands" approach works (a, b = b, a
, see this Stack Overflow question) and (2) multithreading exists, and there are some (obscure) ways to swap two variables without a temporary variable. So, how should I answer the question "why can't I use two hands"?
Remember, they are just learning lists, so explaining something like multithreading would be too difficult.
What's a good way to answer that question, without confusing them?