codebar / tutorials

🗒 codebar's tutorials
http://tutorials.codebar.io/
258 stars 241 forks source link

Python lesson 3 list examples #363

Closed ecmendenhall closed 6 years ago

ecmendenhall commented 6 years ago

Here are some changes to the list examples in Python lesson 3 that make them a little more clear. My pair ran into some confusion with two things:

1) This example seems to be wrong:

>>> places_to_visit
['Mexico', 'Peru', 'Kenya', 'Nepal', 'New Zealand']

>>> places_to_visit.pop()
'Peru'
>>> places_to_visit
['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand']

.pop() will pop off the last element of the list, 'New Zealand'.

2) It seems clearer to explicitly reset the list before each example. We were a little confused about whether the examples are supposed to be one continuous REPL session or isolated examples.

(Also included a little typo fix for "Colombia" 🇨🇴 😸 🇨🇴 )

matyikriszta commented 6 years ago

I agree it's probably a good idea to reset the list to make it clearer what each method does. Thanks @ecmendenhall