dimanche 15 avril 2018

Unexpected python error: 'int' object is not subscriptable

this error has been talked about many times on this site already but i think mine is different.

My code (simplified):

import random

x = random.randrange(1, 21[1])

print(x)

I just want to generate a random number from 1 and 20, is there a better way?

All the other entries about this error

(TypeError: 'int' object is not subscriptable)

include an int(), mine doesn't even.

Thanks




Aucun commentaire:

Enregistrer un commentaire