add brackets to print for py3
use range instead of xrange (for py3). maybe slower on py2