Refactored Episode 11 "Lists": List combinations, nested lists, removing list elements #679
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Includes and closes #618: Use pop() instead of del in the Lists lesson?
When working through the "Lists" episode I noticed potential for streamlining and isolating some proposed concepts.
extend
, I created a separate section for merging lists.Hi Carpentry Team,
As I went through the "Lists" episode, I noticed that some programming concepts are mixed or truncated in the material.
First, the section about append introduces the concepts of lists merging via
extend
and also the possibility of nested lists.I extracted the existing part of
extend
under the general umbrella of merging lists, as I think the episode would benefit from this logical separation.Additionally, I introduce list merging via the
+
operator, which is the pythonic way, often used in practice.I moved the discussion of lists being able to have lists as items into the fitting section about mixing data types. As lists are just a data type, the possibility of lists having lists as members is just a logical conclusion.
Lastly, I tried to generalize the section about using del to remove items.
del
is not the only option to remove list elements andpop
is also an essential element. This was also discussed in #618.I incorporated
pop
into the existing example withdel
.I would be happy for feedback.
This is my first issue in this repository, so please have mercy if I have overlooked some guidelines. :)
Cheers,
Tobias