[Edu-sig] docs.tutorial function example - too complicated
roberto
roberto03 at gmail.com
Sun Dec 16 09:50:44 CET 2012
Give a try to:
codecademy
or
learnstreet
Much easier to start, much more engaging to continue.
Going to test it with youngsters.
On Sun, Dec 16, 2012 at 12:52 AM, Jurgis Pralgauskis <
jurgis.pralgauskis at 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 at python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
--
Roberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20121216/44353b12/attachment.html>
More information about the Edu-sig
mailing list