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

wants to merge 5 commits into
base: gh-pages


None yet
4 participants

gboushey commented Dec 16, 2016

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.

gboushey added some commits Dec 16, 2016

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

This comment has been minimized.

gboushey commented Dec 16, 2016

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.

This comment has been minimized.

gboushey commented Dec 16, 2016

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.


This comment has been minimized.


tbekolay commented Dec 31, 2016

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 As you mention, the two concepts are pretty closely connected (lists and for loops). The reason we used strings in this episode is so that we could talk about for loops without the cognitive load of lists. There's definitely a case to be made that lists should be discussed before loops, but I think in either case we want to talk about them separately. In my opinion, for loops are a more fundamental concept in programming so I like to get to it quickly -- it's a powerful construct! Whereas lists are not necessarily as mind blowing -- they kind of follow from the idea of looping over something. This is something we do a lot in this lesson, is give the big important idea first, then fill in the details later. python-novice-gapminder takes the opposite approach, where we start small and build up to these ideas (you'll notice there that lists are introduced before loops). I think that, because python-novice-gapminder now exists, we should keep the for loops first in this lesson.

What do you think about moving your text to to give some more context to the list introduction? Also, when you do this, please add new lines to your markdown source; if you look at the rest of the files, there are newlines inserted manually at reasonable places. The reason for this is so that when people make changes to the text in the future, the diff is easier to read, as only the lines that are changed get marked as changed (whereas if it's all in one line, then we have to hunt within that line to figure out what's changed).


This comment has been minimized.

gboushey commented Jan 6, 2017

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...

rgaiacs pushed a commit to rgaiacs/swc-python-novice-inflammation that referenced this pull request May 6, 2017

Rubric for scoring applications for open instructor training.
This closes swcarpentry#336 and incorporates feedback given on that issue.

@maxim-belkin maxim-belkin force-pushed the swcarpentry:gh-pages branch from 4753644 to 90848ea Oct 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment