Important Notice:

Course Content
The Calendar Module
Library Function/Predefined Functions
0/4
Sys Module
Library Function/Predefined Functions
0/2
OS Module
Library Function/Predefined Functions
0/2
Functions in Python (Chapter-10) M3-R5
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

error: Content is protected !!