Computer Science

Consider the code given below:

import random
r = random.randrange(100, 999, 5)
print(r, end = ' ')
r = random.randrange(100, 999, 5)
print(r, end = ' ')
r = random.randrange(100, 999, 5)
print(r)

Which of the following are the possible outcomes of the above code ? Also, what can be the maximum and minimum number generated by line 2 ?

(a) 655, 705, 220
(b) 380, 382, 505
(c) 100, 500, 999
(d) 345, 650, 110

Python Data Handling

18 Likes

Answer

The possible outcomes of the above code can be:

Option (a) — 655, 705, 220
Option (d) — 345, 650, 110

Maximum number can be 995 and minimum number can be 100.

Answered By

8 Likes


Related Questions