• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


26 Apr, 2025

Updated at 20 May, 2025

Pair all elements leaving alternate element in a list and form a new list of lists

I have a list which I would like to have unique element pairs generated for every alternate element

List = [ L1, L2, L3, L4, L5, L6, L7,L8 ]

List_in_pairs = [[L1,L3], [L2,L4], [L5,L7],[L6,L8]]

I tried

list_in_pairs = list(zip(IO_ds[::1], IO_ds[2::1])), but that doesnt seem to generate pairs as above fashion. Any insights please ?