Hi everyone, in this video am going to explain how to print random numbers in python
Lets start the code,
before we start , lets import random module
use randint method from random module and use print statement to print numbers randomly
in randint method i used 2 arguments that is range from 1 to 10,
in output we wil get random number between 1 to 10 , once we execute the code,
lets run the code,
now we got 3 , lets run the code again
now we got 6 like this we can get any random number between given range,
now if you want to print random numbers from 1 to 10,continuously upto 10 attempts
then we will use for loop concept
lets write the code,
here range will run from 0 to 9 and iterate upto 10 times,
lets run the code again,
in output we can observe that , got 10 random numbers from 1 to 10,
THANK YOU FOR WATCHING THIS VIDEO,
import random
for x in range(10):
print (random.randint(1,10))
On this page of the site you can watch the video online Python Tutorial - How to get RANDOM numbers in PYTHON with a duration of hours minute second in good quality, which was uploaded by the user Appanna Damu 02 October 2017, share the link with friends and acquaintances, this video has already been watched 63 times on youtube and it was liked by 5 viewers. Enjoy your viewing!