On May 26, 1:43 pm, Steve Howell <[EMAIL PROTECTED]> wrote:

>     ------
>     parentRabbits, babyRabbits = (1, 1)
>     while babyRabbits < 100:
>         print 'This generation has %d rabbits' %
> babyRabbits
>         parentRabbits, babyRabbits = (babyRabbits,
> parentRabbits + babyRabbits)
>
>     ------
>     # def defines a method in Python
>     def tax(itemCharge, taxRate = 0.05):
>         return itemCharge * taxRate
>     print '%.2f' % tax(11.35)
>     print '%.2f' % tax(40.00, 0.08)
>

For the person new to programming (doesn't come from C or other
languages), I think you need to add a separate explanation of string
formatting and how it works, or at least add a comment that tells them
you are using string formatting so that they can search and find out
how it works. If your aim is to teach simple programming concepts, why
confuse them so early on with fancy interpolation?

Something like

# uses Python string formatting
# http://docs.python.org/lib/typesseq-strings.html

but really I think it will just be a distraction

rd


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to