Splitting A List Into Two Seperate Lists, By Every Other Item In Python
Hello I have a quick question I cant seem to solve. I have a list: a = [item1, item2, item3, item4, item5, item6] And I want to split this list into two seperate ones by everythin
Solution 1:
Use slicing, specifying a step:
b,c= a[::2], a[1::2]
Post a Comment for "Splitting A List Into Two Seperate Lists, By Every Other Item In Python"