Why print number 6 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why print number 6

import random for i in range(5): value = random.randint(1, 6) print(value)

12th Jul 2020, 11:11 AM
W.D.M.M.S.Karunarathna
W.D.M.M.S.Karunarathna - avatar
2 Answers
+ 3
It can print any number from 1 to 6 five times randomly because as Bagon said it's not exclusive it's inclusive. Range is exclusive that's why it doesn't prints the end number.
12th Jul 2020, 11:16 AM
Arctic Fox
Arctic Fox - avatar
+ 1
Range(1,6)=1,2,3,4,5 ?????????????
12th Jul 2020, 11:21 AM
W.D.M.M.S.Karunarathna
W.D.M.M.S.Karunarathna - avatar