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))
En esta página del sitio puede ver el video en línea Python Tutorial - How to get RANDOM numbers in PYTHON de Duración hora minuto segunda en buena calidad , que subió el usuario Appanna Damu 02 octubre 2017, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 63 veces y le gustó 5 a los espectadores. Disfruta viendo!