Functions Not Fun (yet)-please help!

Cathy James nambo4jb at gmail.com
Sun Jan 16 09:49:18 EST 2011


Dear all,

I can't thank you enough for taking time from your busy schedules to assist
me (and others) in my baby steps with Python. Learning about functions now
and wondering about some things commented in my code below. Maybe someone
can break it down for me and show me why i cant print the function i
created. I am using IDLE, saved it as .py

def my_func(a, b="b is a default" ,c="c is another default"):
    print (a)
    print (b)
    print (c)


#printing the function itself:

#1. assign value to a only, b and c as default:
a= "testing"
print (my_func(a,b,c)) #why does program say c is not defined, tho default
in function above?
#2. assign a and b only, c is default
print my_func(a="testing a", b="testing b")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110116/ddee2c14/attachment.html>


More information about the Python-list mailing list