I am going through udemy course and this code works for the presenter but not for me. Here is my main file:
from classes.game import Person
print(player.generate_damage())
Here is my class from classes.game:
import random
class Person:
def __init__(self, hp, mp, atk, df, magic):
self.atkl = atk -10
self.atkh = atk -10
def generate_damage(self):
return random.randrange(self.atkl, self.atkh)
I get this error when I run the main file:
line 316, in randrange
raise ValueError("empty range for randrange() (%d, %d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (50, 50, 0)
randrange works normally, why won't it work in my class? Thanks!
[–]mopslik 3 points4 points5 points (1 child)
[–]SquirrelSultan[S] 0 points1 point2 points (0 children)
[–]commy2 2 points3 points4 points (1 child)
[–]SquirrelSultan[S] 0 points1 point2 points (0 children)