For the list below - "A" - I would like to return the index of the elements in "A".....except if the element in "A" equals 'SCR'. Given this list/ code:
INPUT:
A=['126.00', '9.00', '1.50', '9.50', '9.50', 'SCR', '19.00', '12.00']
B=[(A.index(i)+1) for i in A if not i=='SCR']
print(B)
OUTPUT:
[1, 2, 3, 4, 4, 7, 8]
Notice that 4 repeats.
The required output is:
[1,2,3,4,5,7,8]
B = [index for item, index in enumerate(A) if item != "SCR"]