jeudi 9 juillet 2020

getting a random integer

I've used this function in many programs:

> def rnd(max):
>> return randint(0, max - 1)

But now I get this message:

#  File "C:\Users\hal\AppData\Local\Programs\Python\Python38-32\warranty.py", line 34, in rnd
#    return randint(0, max - 1)
# TypeError: unsupported operand type(s) for -: 'list' and 'int

I don't understand.




Aucun commentaire:

Enregistrer un commentaire