Can anyone explain this code? Just tell me why the output is 4 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone explain this code? Just tell me why the output is 4

python coding(modules) https://code.sololearn.com/cl8ZzfrT226r/?ref=app https://code.sololearn.com/cl8ZzfrT226r/?ref=app

27th Jun 2017, 1:58 PM
Neenadk
Neenadk - avatar
3 Answers
+ 2
It's not just 4 it generates a random number for 1 to 6
27th Jun 2017, 1:59 PM
Hetbo.net
Hetbo.net - avatar
+ 2
the output could be 1 to 6
27th Jun 2017, 2:00 PM
Hetbo.net
Hetbo.net - avatar
+ 1
import random value=random.randint(1,6) print(value) The above code will generate a random number between the two parameters entered. In this case, the parameters are 1 and 6. So Python will generate a random number between these two numbers.
27th Jun 2017, 2:01 PM
Caleb Jore
Caleb Jore - avatar