Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # When you've understood the difference between the three methods,
- # write a procedure list_test which takes three lists as inputs. You should
- # mutate the first input list to include 'a' as the last entry, mutate the
- # second to include the entries 'a', 'b', 'c' and finally the last list should
- # not be mutated but a copy should be returned with the additional entry 'w'.
- first_input = [1,2,3]
- second_input = [4,5,6]
- third_input = [7,8,9]
- a = first_input
- b = second_input
- c = third_input
- #print a
- #print b
- #print c
- def list_test(a,b,c):
- a.append("a")
- b= b + ["a","b","c"]
- d=c+["w"]
- return a,b,d
- print "results of procedure", list_test(first_input, second_input, third_input)
- #>>> [7,8,9,'w']
- print first_input
- #>>> [1,2,3,'a']
- print second_input
- #>>> [4,5,6,'a','b','c']
- print third_input
- #>>> [7,8,9]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement