You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by jdonwells March 6, 2022
There are two problems with contrived examples. The first is code that the students can't understand because it simply makes no sense. The second is most of these contrived examples are badly written Python. We want to show the students well written Python only.
I would even go so far as to say if you can't think of a well written Python example maybe you should skip what you want to show them entirely. Showing the students how to traverse a list using for i in range(0, len(list)) is probably not something to show them at all. There are no good examples because no one would do that.
Discussed in #365
Originally posted by jdonwells March 6, 2022
There are two problems with contrived examples. The first is code that the students can't understand because it simply makes no sense. The second is most of these contrived examples are badly written Python. We want to show the students well written Python only.
I would even go so far as to say if you can't think of a well written Python example maybe you should skip what you want to show them entirely. Showing the students how to traverse a list using
for i in range(0, len(list))
is probably not something to show them at all. There are no good examples because no one would do that.In Unit 4 lesson 2 we show them this code:
The correct way to do that is this:
We also show them this code:
The correct way to do that is this:
Here are my new examples. I am going to show 4. One each for the major traversals (map, filter, reduce) and one for using range.
Traversing a list to transform it. (map)
Traversing a list to summarize the items. (reduce)
Using a traversal to filter a list. (filter)
Using range() to generate a list for traversal.
The text was updated successfully, but these errors were encountered: