Teaching the "range" function in Python 3

Rustom Mody rustompmody at gmail.com
Fri Jun 30 00:44:00 EDT 2017


On Friday, June 30, 2017 at 8:28:23 AM UTC+5:30, Chris Angelico wrote:
> On Fri, Jun 30, 2017 at 12:33 PM, Rick Johnson wrote:
> > A better *FIRST* example would be
> > something like this:
> >
> >     def add(x, y):
> >         return x + y
> >
> > When teaching a student about functions, the first step is
> > to help them understand *WHY* they need to use functions,
> > and the second is to teach them how to define a function. In
> > my simplistic example, the practical necessity of functions
> > can be easily intuited by the student without the
> > distractions...
> 
> ... except that you've made your first function so trivial that it
> doesn't need to be a function. How does that help anyone understand
> why they need functions? What's the point of writing "add(5, 7)"
> rather than "5 + 7"? So you need something else around the outside to
> justify even having a function at all.

Same logic applies  to fibonacci also — “Why the f___ are these old fogies teaching
us fibonacci and this other crap instead of IOT/Big-Data/how-to-write-an-app/cloud…”
or whatever else is hot
And if you think this is a theoretical strawman it just means youve not taught
enough to know that motivation is at least big a problem as any specific technique/algorithm/language/technology/etc

So yes Rick's example has slightly less motivation than fib
But if you are focussing on technique its better than the fib — at least it does
not contain a blithering print — a point I am sure you will agree with Chris <wink>



More information about the Python-list mailing list