CBSE Class 12 Computer Science
Question 56 of 62
Using Python Libraries — Question 9
Back to all questions 9
Question Consider the following code :
import random
print(100 + random.randint(5, 10), end = ' ' )
print(100 + random.randint(5, 10), end = ' ' )
print(100 + random.randint(5, 10), end = ' ' )
print(100 + random.randint(5, 10))Find the suggested output options 1 to 4. Also, write the least value and highest value that can be generated.
- 102 105 104 105
- 110 103 104 105
- 105 107 105 110
- 110 105 105 110
105 107 105 110
110 105 105 110
The least value that can be generated is 105 and the highest value that can be generated is 110.
print(100 + random.randint(5, 10), end=' ') — This statement generates a random integer between 5 and 10, inclusive, and then adds 100 to it. So, the suggested outputs range from 105 to 110.
The lowest value that can be generated is 100 + 5 = 105.
The highest value that can be generated is 100 + 10 = 110.