0

Why in range function last no. Is being printed here when generally if is not

In module calling random no.s print(random.randit(1,6)) Why here 6 being printed even being the last no. Of the range

25th Jan 2020, 6:00 PM
Gaurav Gautam
Gaurav Gautam - avatar
4 Respuestas
+ 2
Because the creators of that function decided to implement it so.
25th Jan 2020, 6:06 PM
Juho Pesonen
Juho Pesonen - avatar
0
So that means range function is not used in it It's something else defined using (1,6) but not range
25th Jan 2020, 6:09 PM
Gaurav Gautam
Gaurav Gautam - avatar
0
Gaurav Gautam random.randint(x, y) only means you want to get a random integer between x and y, it does not matter whether the last integer should be ignored or not.
25th Jan 2020, 6:11 PM
Seb TheS
Seb TheS - avatar
0
Are you confusing randint() for randrange()?
25th Jan 2020, 6:16 PM
rodwynnejones
rodwynnejones - avatar