Write a random lottery program in python. The list of personnel and the list of prizes can be changed upon request

Glad to serve you! This is a simple sample code about writing a random lottery program in Python: import randomdef draw(): # List the list of people names = ['Zhang San', 'Li Si', 'Wang Wu', 'Zhao Liu']# columns Prizes = ['iPhone', 'iPad', 'MacBook', 'iPod']# Randomly draw a person winner = random.choice(names)# Randomly draw a prize prize = random.choice(prizes)# Return to the lottery Result return winner, prizeif name == ' main ': winner, prize =

Guess you like

Origin blog.csdn.net/weixin_35753291/article/details/129618184