hi guys, super beginner programmer so noob question, I have a list of strings alternating numbers and numbers+" bpm"(eg: ['123123','123123 bpm','123123','1231231 bpm']) I am trying to remove all the " bpm" from the odd-indexed strings then convert every element of the list from a string into a float when there's only numbers left. However my brain is about to explode and I'm not making any progress, Can someone help me with this code?
Code:
indexCounter = 0
for el in list:
if indexCounter%2==1:
list[indexCounter]=list[el[:-4]]
list[indexCounter]=float(el)
indexCounter += 1
I am returned with TypeError: list indices must be integers or slices, not str