Name ‘xrange’ is not defined in Python 3 [duplicate] You’re probably using Python3, where xrange has become range.