4 Réponses
+ 9
Shashi Ranjan Just a small correction: when calling random.randint(10,50) it is possible to generate 50.
https://docs.python.org/2/library/random.html#random.randint
+ 8
Edited:
For just basics,
first import random in your code
>>>import random
random.random() generates a random number between 0 and 1.
random.randint(10,50) will generate a random integer in between 10 & 50 (including 50).
there are many more methods in the random module you can always take help from the console itself by writing this
>>>help(random)
+ 3
Eduardo Petry
Gee, I missed that!
Thanks for the correction!😄
0
Thanks shashi and eduardo