vendredi 17 juin 2016

Fixing list out of range error. Python

I need a random number 1 - 3 to be generated. There error I'm getting is IndexError: list index out of range. My code is as follows.

weaponList = [0,1,2]
weapon2 = weaponList[random.randint(0,3)]




Aucun commentaire:

Enregistrer un commentaire