![](https://secure.gravatar.com/avatar/9b31cadf5dab005ee17e04d8e41bb7cd.jpg?s=120&d=mm&r=g)
I approach this by introducing the for-loop initially as a way to work through a list. Those of us brought up on the numerical for-loop in C or early Java think that iterating a list is "advanced", but free of these preconceptions, children find it natural to write:
mylist = [2,3,"bang!"]
for thing in mylist:
print(3*thing) Then range() can be introduced as "a smart way to make a list of numbers", which I demonstrate with list(range(10)) to avoid a discussion of lazy iteration. Jeff Allen On 13/07/2016 06:19, Jurgis Pralgauskis wrote:
When I try to teach Python to young kids, the big obstacle is describing repetitions in simple way (esp. for turtle graphics).
for a in range(4): ....
More py-zen would be
repeat 4: ....
I know some py-edu-environments have their hacks: https://codecombat.com/ has "loop" instead "while True" http://reeborg.ca/reeborg.html has the "repeat n"
Also "repeat n" is used in Blockly <https://blockly-games.appspot.com/turtle?lang=en&level=10> and Scratch <https://wiki.scratch.mit.edu/wiki/Repeat_%28%29_%28block%29>
Also scientific math env has kind of hack for "range(a, b+1)" -- just "[a..b]" (like in CoffeScript <https://coffeescript-cookbook.github.io/chapters/syntax/for_loops>): http://sagemath.wikispaces.com/Counters
***My ideas, how to implement this***
- IDE (plugin) translates "repeat" to "for.." on run, on errors it could translate stuff back to hide any mention of "for.." :) or after translation could leave a comment that it has been translated from "repeat"
- PEP for even more edu-friendly Python: "py-zero" (with possibly more stuff)? :)
-- Jurgis Pralgauskis tel: 8-616 77613; Don't worry, be happy and make things better ;) http://galvosukykla.lt
_______________________________________________ Pythonedu-wg mailing list Pythonedu-wg@python.org https://mail.python.org/mailman/listinfo/pythonedu-wg