I want to write code that uses slicing to get rid of the the second 8 so that here are only two 8’s in the list bound to the variable nums. The nums are as below:
nums = [4, 2, 8, 23.4, 8, 9, 545, 9, 1, 234.001, 5, 49, 8, 9 , 34, 52, 1, -2, 9.1, 4]
This is my code:
nums=[0:4:-1]
nums=[:4]+[5:]
but slicing seems to remove the front or bottom part, how can we remove the middle part?