newby qn about functions

Joe Goldthwaite joe at goldthwaites.com
Tue Jan 18 13:01:19 EST 2011


I'm not sure I understand the question completely but maybe the function
below does what you want.

def lower_case(s):
    
    return “Testing Functions-lower case: ” + s.lower()

print lower_case(‘AbCdEfG’)

________________________________________
From: python-list-bounces+joe=goldthwaites.com at python.org
[mailto:python-list-bounces+joe=goldthwaites.com at python.org] On Behalf Of
Cathy James
Sent: Tuesday, January 18, 2011 3:02 AM
To: python-list at python.org
Subject: newby qn about functions

#This has to be very simple, but I don't get it-please help
 
def
lower_case(s): 
    #return s
    print(s) 
    #return s.lower() 
    print(s.lower()) 
s=
"Testing Functions-lower case: " 
lower_case(s)
"""how can i use a return statement  to write a function that returns the
string "Testing Functions-lower case: "and the lowercase representation of
its string parameter""" If I uncomment the above, nothing outputs to
console:(
 
Much appreciation as always.




More information about the Python-list mailing list