The program generates and prints 10 random integer numbers between x and 99 (inclusive), where x ranges from 0 to 9.
The random.randrange() function is used to generate random integer numbers within a range. It takes two arguments: start and stop, where start is the starting number of the range and stop is the ending number of the range (exclusive). In this program, the start value is the value of the loop variable x, which ranges from 0 to 9, and the stop value is 100 (exclusive).
The res variable is assigned a random integer value generated by random.randrange(), and this value is printed to the console using the print() function.
import random for x in range(10): res = random.randrange(x, 100) print(res)
80 37 6 52 41 83 60 81 98 38
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions