Generate random numbers in Python

Channel Avatar
Comment
X
Share
Generate random numbers in Python
Generate random numbers in Python
#python #tutorial #course

Python random module tutorial example explained

00:00:00 random module
00:04:32 number guessing game

import random

low 1
high 20
options [‘Rock’, ‘Paper’, ‘Scissors’]
cards [‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ’10’, ‘J’, ‘Q’, ‘K’, ‘A’]

#number random.random()
#number random.randint(1, 6)
#number random.randint(low, high)
#choice random.choice(options)
#random.shuffle(cards)

Take the opportunity to connect and share this video with your friends and family if you find it useful.

Keywords: python tutorial for beginners, python course

Read Also

Leave a Reply

Your email address will not be published. Required fields are marked *