p3 fix: replace range with xrange