SimplePrograms challenge
pelon
pelonpelon at gmail.com
Thu Jun 21 04:58:46 EDT 2007
*** New Thread
#5 has been bothering me.
def greet(name):
print 'hello', name
greet('Jack')
greet('Jill')
greet('Bob')
Using greet() three times is cheating and doesn't teach much and
doesn't have any real world use that #1 can't fulfill.
I offer this replacement:
def greet(name):
""" This function prints an email signature """ #optional doc
string highly recommended
print name + " can be reached at", #comma prevents
newline from being printed
print '@'.join([name, "google.com"])
greet('Jill')
I think it's important to teach new pythonistas about good
documentation from the start. A few new print options are introduced.
And as far as functionality goes, at least it does something.
More information about the Python-list
mailing list