Advertisements
Advertisements
Question
ABC School has allotted unique token IDs from (1 to 600) to all the parents for facilitating a lucky draw on the day of their Annual day function. The winner would receive a special prize. Write a program using Python that helps to automate the task. (Hint: use random module)
Answer in Brief
Advertisements
Solution
It is suggested in the question to use the 'random' module. Therefore, the ‘randint()’ function can be used which will return a random integer within the given range as parameters.
Program:
from random import randint
#Defining the function to generate the random number between 1 and 600
def generateRandom():
print("The winner of the lucky draw is the parent with token id: ",randint(1, 600))
print("")
#calling the function
generateRandom()
OUTPUT:
The winner of the lucky draw is the parent with token id: 313shaalaa.com
Is there an error in this question or solution?
