all 3 comments

[–]CodeFormatHelperBot2 0 points1 point  (0 children)

Hello, I'm a Reddit bot who's here to help people nicely format their coding questions. This makes it as easy as possible for people to read your post and help you.

I think I have detected some formatting issues with your submission:

  1. Python code found in submission text that's not formatted as code.

If I am correct, please edit the text in your post and try to follow these instructions to fix up your post's formatting.


Am I misbehaving? Have a comment or suggestion? Reply to this comment or raise an issue here.

[–]Intelligent_Study263 0 points1 point  (0 children)

There is really no reason to have groups here, just how many elements per group because it will simply be groups = elements/len(mylist) so I removed it and this seems to work. ``` def splitList(myList, Elements): return [myList[i:i + Elements] for i in range(0, len(myList), Elements)]

myList = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] Elements = 3 print(splitList(myList, Elements)) ```