Hey folks,
I need help with my python code
Here is the list:-
list=[[“Doe”,1,74.0],[“John”,2,65.0],[“Lorem”,3,99.0]]
I want to delete the whole sublist with an index of the middle number
for eg. I’ll give input as 2 and delete item should be [“John”,2,65.0].
so list will be
list=[[“doe”,1,74.0],[“Lorem”,3,99.0]].
try: # because the input may go beyond the bounds
del list[int(input())]
# or list.pop(int(input())
# or list=[list[i] for i in range(len(list)) if i != int(input())]
except:
print('The index you entered is out of bounds')