miloharper / simple-neural-network

A neural network written in Python, consisting of a single neuron that uses back propagation to learn.
MIT License
372 stars 177 forks source link

Getting Error of name 'xrange' is not defined #5

Open HP1111 opened 6 years ago

HP1111 commented 6 years ago

I m new to this, but just copied full code in python 3.6 and got error xrange not defined is there any input file or something needed other than just coping code down and executing?

xCloudx8 commented 6 years ago

xrange is a python built-in function no previous installation needed, check the syntax https://www.pythoncentral.io/how-to-use-pythons-xrange-and-range/

patrickmcgrory commented 6 years ago

change xrange to range

fsbooks commented 6 years ago

To embellish comments: xrange is a a python 2 function, which does not exist in python 3 (more precisely, python 2 range went away with python 3, with xrange renamed to range). See bottom of the pythoncentral link provided by xCloudx8. I suspect you also had problems with print which was changed from a "special statement" to a function. You can't "print x" in python 3, rather use "print(x)".