I'm not sure if this has been asked before as it seems to be a simple question, I tried to search it but did not find a very good answer.
Say I have a list of numbers a
. I know I can get out every fifth number by a[::5]
.
What should be the simplest way to get the rest of the list (items in a
but not in a[::5]
)?
Edit:
this is not the same question as Finding elements not in a list as I already know that the rest of the list consists of a[1::5]+a[2::5]+a[3::5]+a[4::5]
, I'm just asking is there a simpler way / syntax sugar for that?
Edit:
Thank you all for answering.
Is there a solution without scanning over the whole list?