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))
На этой странице сайта вы можете посмотреть видео онлайн Python Tutorial - How to get RANDOM numbers in PYTHON длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Appanna Damu 02 Октябрь 2017, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 63 раз и оно понравилось 5 зрителям. Приятного просмотра!