About Lesson
randint() Method
The randint() method returns an integer number selected element from the specified range.
Syntax
random.randint(start, stop)
Parameter Values
Parameter |
Description |
start |
Required. An integer specifying at which position to start. |
stop |
Required. An integer specifying at which position to end. |
Example
Return a number between 3 and 9 (both included):
import random
print(random.randint(3,9))
Output:
4