Closed knyghty closed 2 years ago
It looks like a bug introduced in #1743.
CC: @das-g @BiplawSingh
Thanks @knyghty @magul for pointing it out I think explaining the len() function before adding the new key-value pair would be a better idea
Thank you @knyghty for pointing this out. :heart:
Thank you @BiplawSingh for the suggested fix. In my opinion, the reordering suggested in 7de4db4968197a9a7cb4a8837cddd2d286e4a30e does indeed make sense. As pull request BiplawSingh/tutorial#1 had the master
branch of your own fork as its target, which doesn't have much effect, I've opened a new pull request #1747 with your commit (and with a small source-only modification by me.)
Issue description
This came up in a workshop today.
In the dictionary tutorial, a dict is created with three keys:
Later, there is a section showing how to add a key:
And then showing how you can get the length:
The first command is preceded by "try writing the following command". The second doesn't have an explicit instruction "you can". And the third starts with "go ahead and type this command". So the result of
len(participant)
is correct if the user didn't type the second example (it should be 4). This caused a bit of confusion. I think this could be reworded a bit so that the second part is an instruction and then the return value oflen(participant)
can be 4.Language
English but I didn't check others.