Python Random Number
Random Number
Python does not have a random()
function to
make a random number, but Python has a built-in module called
random
that can be used to make random numbers:
Example
Import the random module, and display a random number between 1 and 9:
import random
print(random.randrange(1,10))
Try it Yourself »
In our Random Module Reference you will learn more about the Random module.
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.