Python Tutorial - How to get RANDOM numbers in PYTHON

Publicado em: 02 Outubro 2017
no canal de: Appanna Damu
63
5

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))


Nesta página do site você pode assistir ao vídeo on-line Python Tutorial - How to get RANDOM numbers in PYTHON duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Appanna Damu 02 Outubro 2017, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 63 vezes e gostou 5 espectadores. Boa visualização!