1.

Which of the following is equivalent to random.randint(3, 6)?(a) random.choice([3, 6])(b) random.randrange(3, 6)(c) 3 + random.randrange(3)(d) 3 + random.randrange(4)The question was asked at a job interview.I'm obligated to ask this question of Random Module in chapter Mapping Functions and Modules of Python

Answer»

The correct option is (d) 3 + random.randrange(4)

The EXPLANATION: random.randint(3, 6) can RETURN any ONE of 3, 4, 5 and 6.



Discussion

No Comment Found

Related InterviewSolutions