-2

i have a list like this :

data = ["a","b","c","d","e","f","g","h","i","k"]

and list of indices like this :

idxs = [2,6,8]

and i want the result be these lists :

["a","b","c"]
["d","e","f","g"]
["h","i"]
["k"]
  • 1
    what have you tried? and what are you seeing instead of what you expect? – Ben May 10 '22 at 19:00
  • Welcome to Stack Overflow! Please take the [tour], read [what's on-topic here](/help/on-topic), [ask], and the [question checklist](//meta.stackoverflow.com/q/260648/843953), and provide a [mre]. "Implement this feature for me" is off-topic for this site because SO isn't a free online coding service. You have to _make an honest attempt_, and then ask a _specific question_ about your algorithm or technique. – Pranav Hosangadi May 10 '22 at 19:00
  • Note: The only difference between your question and the duplicate is that your `idxs` are off-by-one from sane slice indices; add one to all of them, and the duplicate answers apply directly. – ShadowRanger May 10 '22 at 19:01

0 Answers0