I have a list (A) that is the product of ( x * y). I am trying to create y lists that contain x elements.
I need to either print a new line every x elements, or divide the list into y lists that contain x elements.
I've researched many similar threads, but still have no idea.
Thank you
edit: to address some of the recent comments @ b4hand, thank you for letting me know. I have removed that. @ jonrsharpe, this is part of a larger assignment. I need to create a specific shape with input. I have managed to do the rest, and I believe that splitting it like I described will result in the shape I want. I haven't really tried anything, but I've read the following threads: - How do you split a list into evenly sized chunks? - http://www.pythoncentral.io/how-to-slice-listsarrays-and-tuples-in-python/ - Splitting a list of into N parts of approximately equal length
- Going over the links I think I found one resource that I need to look into. I'm not really looking to get code, I'm just looking for a tutorial or related tips to get started.
edit: I was unsuccessful in trying to use pprint to resolve my issue.
ediit: The values of x and y will be entered by the user.
edit: @joergwork that is close, but I do not want to be counting by 3