using xrange in python2

using xrange in python2.