for i in range(-1, 2):
for i in [-1, 0, 1]:
range() is technically a bit slower than just typing out the list as the
range() function has to create a list and that takes ~0.012 seconds.
range() took ~0.045 seconds.
Using a list with the same amount of characters took ~0.033 seconds.
I do recommend that you use
range() as it is much easier and the small difference of ~0.012 seconds is not worth it.
I hope this helped!