CBSE Class 11 Computer Science
Question 44 of 63
Introduction to Python Modules — Question 13
Back to all questionsTo generate random numbers between 1 and 5, we should use the randint() function from the random module. The randint(a, b) function accepts two parameters, a and b, as the lowest and highest number, returns a number N in the inclusive range [a, b], which signifies a <= N <= b. This function generates a random integer number between two given numbers. In contrast, the random() function generates a random floating point number from 0 to 1.