Introducing the "for" loop

Peter Otten __peter__ at web.de
Thu Oct 5 09:57:48 EDT 2017


Stefan Ram wrote:

> "ROGER GRAYDON CHRISTMAN" <dvl at psu.edu> writes:
>>On Wed, Oct 4, 2017 22:42 Stefan Ram (ram at zedat.fu-berlin.de) wrote:
>>Steve D'Aprano <steve+python at pearwood.info> writes:
>>>>So, "bottom-up" in this case means: iterators should be
>>>>taught before for-loops.
>>>>Why?
>>The easy answer here is to not use the range in the first for loop.
> 
>   I never intended to use »range«. But I also will not use lists.
> 
>   Very early in the course, I teach numeric and string literals:
> 
> 1, 2.3, 'abc'
> 
>   then come operators, functions and »if«, »while« and »try«.
>   But neither »range« nor lists have been shown so far.
> 
>   The basic course may already and there after about 12 - 18 hours.
>   (This time includes many exercises in the classroom.)
> 
>   But if I have time to introduce »for«, I'll do it as follows
>   at this point in the course:
> 
>   <now speaking like a teacher:>

To me it looks like Roger has some practical experience in that area.
You should seriously consider his advice lest your students end up missing 
the forest for the trees.





More information about the Python-list mailing list