New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show how to define a list before using strings/chars to illustrate looping #336
Conversation
introducing lists and loops through an explicit python list, rather than through a string.
Added additional looping for list of integers, provided transition into looping for strings. Include explanation that strings can be treated as a list of characters, even if they weren't explicitly defined this way.
changed phrasing and fixed a few typos
Note - this is for instructor training. |
I removed text about strings being lists because this isn't accurate. I've replaced it with a statement that you can access the elements of a string through index or a loop in the same manner. Avoiding discussion of the difference between a string and a list of characters for now.
I made an additional change to indicate that strings are not actually a list of chars, there are some differences. I'm not sure if this is the right time to talk about these differences, might be overload. It could be an interesting example for the class to mention that while they can be treated similarly in some ways, other operations that work on lists will fail, and to see if anyone can come up with a bit of code that will work on a list but not on a string. |
I like the new text; it's well written and easy to follow! However, the content itself is largely a duplicate of episode 3, which is all about lists (see What do you think about moving your text to |
I agree, this is very similar to the gapminder approach (all well as chapter 3 in this series). There's lot of value in keeping the written lessons from getting too verbose. I'll take a look at lesson 3, but I'm hesitant to add too much since I do like how compact it is. Since these lesson plans are designed for workshops with instructors and teaching assistants, there's plenty of opportunity to bring up these as part of a related discussion, so I'm thinking what I wrote might be more useful as instructor notes? Not sure where we'd put something like that right now... |
This closes swcarpentry#336 and incorporates feedback given on that issue.
4753644
to
90848ea
Compare
I noticed that the chapter on loops in python introduces the concept of iterating through a list through strings and characters. I thought that the concepts might be easier to follow if the learners first explicitly defined a list. This way, a learner isn't encountering two ideas at the same time - first, that variables can be lists as well as single value, second that strings aren't ordinary variables even if they seem that way at first.
I added this to the start of the lesson on python loops, then transition into the notion that strings can also be treated as lists, iterated over, accessed through index, and so forth. This may lead to a little bit of repetition, similar loops over strings that a learner already did over a list of integers, but I think the slightly different angle might help reinforce the concepts.
This all does makes the lesson a little longer, but doesn't introduce any new concepts or complexity.