Generating an evenly sized matrix by a given number in python? : I have a python list containing `n` items. I would like to place the items in an (nearly) evenly sized matrix.

I mean, if number of elements is 2, then matrix size would be 1*1,

number of items 4, matrix size: 2*2
number of items 5, matrix size: 3*2
number of items 6, matrix size: 3*2
number of items 7, matrix size: 3*3

I hope you understood the problem.