Update perlin.py

Got "TypeError: 'range' object does not support item assignment" in python3. Apparently range() now returns an iterator, not a sequence. This fixes it to work on python 2.x and 3.x.