निम्नलिखित में से कौन सा नंबर निम्नलिखित कोड द्वारा कभी भी उत्पन्न नहीं किया जा सकता है:
Which of the following number can never be generated by the following code :
random.randrange(0, 50) A
0
B
1
C
49
D
50
Explanation
The correct answer is:
(D) 50
Explanation:
The random.randrange(start, stop) function generates a random number in the range from start to stop - 1, i.e., it includes start but excludes stop.
- In this case,
random.randrange(0, 50)will generate a number between 0 and 49 (inclusive of 0 and exclusive of 50). - Therefore, 50 can never be generated by this code.
Output:
(D) 50
Correct Answer: D) 50