0

I have two list a =[72,82,955,55,.....] and b=[5,7,8...] I want to remove the element from a. list b specifies the indexes from where elements to be removed.

Nawaf Momin
  • 127
  • 1
  • 1
  • 9
  • 3
    Does this answer your question? [Deleting multiple elements from a list](https://stackoverflow.com/questions/497426/deleting-multiple-elements-from-a-list) – doggie_breath Feb 03 '20 at 12:42

1 Answers1

3

You could use a list comprehension in combination with enumerate method in order to apply condition based on the index.

result = [item for index, item in enumerate(a) if index not in b]
Mihai Alexandru-Ionut
  • 47,092
  • 13
  • 101
  • 128