why does the random.randint(1, 6) produce the no. 6? i thought it would only produce no. from 1 to 5? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

why does the random.randint(1, 6) produce the no. 6? i thought it would only produce no. from 1 to 5?

27th Oct 2016, 12:45 AM
Jiggy Barcelona
Jiggy Barcelona - avatar
2 ответов
+ 2
I think you're getting confused because things like lists start with their first item at 0. Quite simply randint(a, b) generates a random integer from a to b inclusive.
27th Oct 2016, 1:21 AM
Adrian Ellis
Adrian Ellis - avatar
0
thanks!
27th Oct 2016, 4:25 AM
Jiggy Barcelona
Jiggy Barcelona - avatar