In a given list delete the value at index 3 and insert it at 2nd and last position?
L = [9, 15, 16, 25, 60]
Answers
Answered by
1
Answer:
Here is the answer, please note that you have to take care of indentation wherever possible.
Explanation:
L=[9, 15, 16, 25, 60]
val=L[3] #pre-storing the value at index 3 for later use
L.remove[3] #removing value present at index 3 of list
L.insert(2, val) #inserting val at index 2
L.append(3) #inserting/appending at last
Similar questions