I have searched for a similar topic, as I assume someone must have come across this problem before. Any links to relevant topics are appreciated :)
I want to delete all values past (and including) the last index of "x".
Given the list: a = [0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5]
Do something, e.g. del a[a.rindex(2):]
And end up with a == [0, 1, 2, 3, 4, 5, 0, 1]
- Note that the 2 is deleted