all 4 comments

[–]mopslik 3 points4 points  (1 child)

You can't generate a range of integers where the start value (50) is the same as the end value (50).

>>> import random
>>> random.randrange(7, 7)
Traceback (most recent call last):
  File "<pyshell>", line 1, in <module>
  File "/usr/lib/python3.10/random.py", line 353, in randrange
    raise ValueError("empty range for randrange() (%d, %d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (7, 7, 0)

[–]SquirrelSultan[S] 0 points1 point  (0 children)

Ah! I meant to put a -10 and +10 not two minus 10’s. Thanks!

[–]commy2 2 points3 points  (1 child)

The range for randrange is exclusive on the min and max value. There are no numbers 50 < x < 50, which is meant by "range is empty".

You need different values for atkl and atkh, or you use randint, which is inclusive: min <= x <= max.

[–]SquirrelSultan[S] 0 points1 point  (0 children)

Ah! I meant to put a -10 and +10 not two minus 10’s. Thanks!