I do a very slow, step by step introduction to functions in http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/functions.html
Lots of students have enormous difficulties with functions. Andy On Sat, Dec 15, 2012 at 5:52 PM, Jurgis Pralgauskis < jurgis.pralgaus...@gmail.com> wrote: > Hi, > > currently more and more schools are trying Py, > so studens read tutorial docs from time to time... > and one of main programming (architecture) subjects starts with quite > a mathematical and unpractical example.. > > http://docs.python.org/3/tutorial/controlflow.html#defining-functions > It's like teaching to pilot airplane, prior to bicycle and car :) > > > I'd propose some simple examples at first: > like in > http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_3/Defining_Functions > or http://www.cplusplus.com/doc/tutorial/functions/ > > def greeting( person ): > print( "Hello", person ) > > def add(a, b): > result = a+b > return result > > z = add(3, 5) > # could aslso graphically show, how data (arguments/results) travel > # as in C++ example > > > def absolute_value(n): > if n < 0: > n = -n > return n > > def count_down( n ): > while n > 0: > print( n ) > n = n-1 > > def average( mylist ): > return sum(mylist) / len(mylist) > > def decide_on_scholarship( marks ): > avg = average(marks) > if avg > 9.5: > return 1000 > elif avg >= 8: > return 200 > else: > return 0 > > > Maybe there is some other list, where it would be more appropriate to > discuss this? > -- > Jurgis Pralgauskis > tel: 8-616 77613; > Don't worry, be happy and make things better ;) > http://galvosukykla.lt > _______________________________________________ > Edu-sig mailing list > Edu-sig@python.org > http://mail.python.org/mailman/listinfo/edu-sig > -- Dr. Andrew N. Harrington Computer Science Department Loyola University Chicago Lakeshore office in the Math Department: 104 Loyola Hall http://www.cs.luc.edu/~anh Phone: 312-915-7999 Fax: 312-915-7998 ahar...@luc.edu
_______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig