For generating random numbers in Python Programming Language, Python’s Random Module function randint(a, b) can be used. Where a, b are some integers and randint function will pick up some random number from range a to b(Both including as well).
Like randint(4, 7) function may return any integer from 4 to 7, it can be 4 or 5 or 6 or 7.
Generating Random Numbers Using Python
# Generating random numbers using Python
import random
random_number = random.randint(10, 23)
print("Random number is =>", random_number)
Output of Above Code
Random number is => 22
More about Random Module => Python’s Random Module Documentation
No Comments
Leave a comment Cancel