Teaching the "range" function in Python 3
Peter Otten
__peter__ at web.de
Fri Jun 30 02:22:42 EDT 2017
Gregory Ewing wrote:
> Don't start with range(). Start with lists, and introduce the for
> loop as a way to iterate over lists. Leave range() until much later.
> You should be able to go a *long* way without it -- it's quite
> rare to need to iterate over a range of ints in idiomatic Python
> code.
Indeed. Among beginners the
for i in range(len(items)):
print(items[i])
idiom is already too common.
More information about the Python-list
mailing list