Name ‘xrange’ is not defined in Python 3 [duplicate]
You’re probably using Python3, where xrange has become range.
You’re probably using Python3, where xrange has become range.
You are trying to run a Python 2 codebase with Python 3. xrange() was renamed to range() in Python 3. Run the game with Python 2 instead. Don’t try to port it unless you know what you are doing, most likely there will be more problems beyond xrange() vs. range(). For the record, what you are seeing is not a syntax error … Read more
In Python 2.x: range creates a list, so if you do range(1, 10000000) it creates a list in memory with 9999999 elements. xrange is a sequence object that evaluates lazily. In Python 3: range does the equivalent of Python 2’s xrange. To get the list, you have to explicitly use list(range(…)). xrange no longer exists.