0

Python provide inbuild function?, like sum, random number generator function etc..

plz tell me how I use random no generator function in python

1st Sep 2018, 1:57 AM
Shubhali Harode
4 Respostas
+ 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
1st Sep 2018, 4:00 AM
Eduardo Petry
Eduardo Petry - avatar
+ 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)
1st Sep 2018, 3:01 AM
Шащи Ранжан
Шащи Ранжан - avatar
+ 3
Eduardo Petry Gee, I missed that! Thanks for the correction!😄
1st Sep 2018, 7:13 AM
Шащи Ранжан
Шащи Ранжан - avatar
0
Thanks shashi and eduardo
2nd Sep 2018, 6:56 AM
Shubhali Harode