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))
Sur cette page du site, vous pouvez voir la vidéo en ligne Python Tutorial - How to get RANDOM numbers in PYTHON durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Appanna Damu 02 octobre 2017, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 63 fois et il a aimé 5 téléspectateurs. Bon visionnage!