+ 4

How to get a random numbers in python

I want to get random numbers in python programme

18th Feb 2018, 4:59 AM
DarkZeus
DarkZeus - avatar
2 Respostas
+ 11
random.randint() is the function to generate random numbers. use range(5) if you only want 5 values returned, etc.). Then the third line: printrandom.randint(1,101) will automatically select a random integerbetween 1 and 100 for you. The process is fairly simple. Basically this code will generate a random numberbetween 1 and 20, and then multiply that number by 5.
18th Feb 2018, 5:22 AM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
+ 6
thank you!!!
18th Feb 2018, 5:32 AM
DarkZeus
DarkZeus - avatar