[Tutor] Functions output

mbikinyi brat mbikinyi_brat at yahoo.com
Fri Apr 17 10:42:26 CEST 2009


Dear all, 
Here are two functions printme and change quite spaced apart. When executed the output in bold are joined. What can I do so that the results are separate in two blocks?
 
#Function definition is here
def printme(str):
    "This prints a passed string into this function"
    print str
    return
#Now you can call printme function
printme("I'm first call to user defined function!")
printme("Again second call to the same function")
 
 
#Function definition is here
def changeme(mylist):
    "THIS CHANGES A PASSED LIST INTO THIS FUNCTION"
    mylist.append([1, 2,3,4])
    
    return
" now you can call the changme function"
mylist=[10, 20, 30]
print "valuse outside the function:", mylist
print "values inside this function:", mylist
 
 
 
>>> 
I'm first call to user defined function!
Again second call to the same function
valuse outside the function: [10, 20, 30]
values inside this function: [10, 20, 30]
>>> 

Regards,
Henry


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090417/f68e4485/attachment.htm>


More information about the Tutor mailing list