More fun exercises with Python

partition_horizontal.py

break a list into 'n' pieces horizontally...

Usage
thelist = range(10)  
partition_horizontal(thelist, 3)  

Returns:

[[1, 2, 3],
 [4, 5, 6],
 [7, 8, 9],
 [10]]

Craig Derington

Veteran full stack web dev focused on deploying high-performance, responsive, modern web applications using Python, NodeJS, Django, Flask, MongoDB and MySQL.

comments powered by Disqus