# # A program that shows that list members value might be changed # in a function + testing # # function 'square' squares all the elements of the list x # def square(x): n=len(x) for i in range(n): x[i]=x[i]*x[i] def test1(): print "TEST1" x=[1,2,3,4,5] print "the input list: \t %s" % x square(x) print "the list after 'square' call:%s" % x def test2(): print "TEST2" x=[0,0,0] print "the input list: \t %s" % x square(x) print "the list after 'square' call:%s" % x def test3(): print "TEST3" x=[-1,-2,-3] print "the input list: \t %s" % x square(x) print "the list after 'square' call:%s" % x test1() test2() test3()