def modifyList( aList ): for i in range( len( aList ) ): aList[ i ] *= 2def modifyElement( element ): element *= 2aList = [ 1, 2, 3, 4, 5 ]print "Effects of passing entire list:"print "The values of the original list are:"for item in aList: print item,modifyList( aList )for item in aList: print item,print "aList[ 3 ] before modifyElement:", aList[ 3 ]modifyElement( aList[ 3 ] )print "aList[ 3 ] after modifyElement:", aList[ 3 ]print "aList[ 2:4 ] before modifyList:", aList[ 2:4 ]modifyList( aList[ 2:4 ] )print "aList[ 2:4 ] after modifyList:", aList[ 2:4 ]
Name (required)
email (will not be published) (required)
Website