Pythons’ list is an inbuilt datatype that stores multiple elements of same and or different types.
as python list has so many inbuilt operations, you can use either pop or del for this operation
syntax will be
you can use del by two ways you can either put a range or simply put an index number of element you h=want to delete
as given below
list = [‘apple’,’ball’, ‘cat’, ‘dog’]
OUTPUT – (’ball’, ‘cat’, ‘dog)
SO del just deletes an element of the index you given to it.
list = [‘a’,’b’,’c’,’d’]
Output – (‘d’)
this will result as list = [‘d’] as it removed elements upto range 2 and
or you can use pop method
Output – (1,3)
will result as (1,3), But just be aware if you didn’t give any parameter it’ll pop the last item from your list. I hope it helps, Happy coding.