Advertisements
Advertisements
प्रश्न
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)
संक्षेप में उत्तर
Advertisements
उत्तर
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
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
