jeudi 4 mars 2021

ValueError: empty range for randrange() (1,1, 0)

I'm writing that takes percent for hitting the number from user and checks if it hit the number, and returns true or false. But I'm still getting this error

ValueError: empty range for randrange() (1,1, 0)

Can you help me ?

def PercentConvertion(Percent):
IntPercent = int(Percent / 100)
Chance = random.randint(1,IntPercent)
purpose = int(IntPercent / 2)
hit = None
if Chance == purpose:
    hit = True
else:
    hit = False
return hit



Aucun commentaire:

Enregistrer un commentaire