Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite0
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
3 Réponses
+ 2
It's not just 4
it generates a random number for 1 to 6
+ 2
the output could be 1 to 6
+ 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.