Q. Start with the list [3, 9, 10]. Do the following:
(a) Set the second entry (index 1) to 17
(b) Add 4, 5 and 6 to the end of the list
(c) Remove the first entry from the list
(d) Sort the list
(e) Double the list
(f) Insert 25 at index 3
Answer =
(a) l.insert(1,17)
(b) l.extend([4,5,6])
(c) l.pop(0)
(d) l.sort()
(e) l.extend(l)
(f) l.insert(3,25)
1st is wrong the index is supposed to be 1
ReplyDeleteSorry, I have corrected it.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )