python中编写抽奖小游戏

 

>>> prizes = ["aaa","bbb","ccc","ddd","eee"]
>>> import random
>>> for i in range(1,11,1):        ## 设计抽十次
    print(f"The {i}th prize is {random.choice(prizes)}!")

    
The 1th prize is ddd!
The 2th prize is ddd!
The 3th prize is bbb!
The 4th prize is ddd!
The 5th prize is ddd!
The 6th prize is eee!
The 7th prize is ccc!
The 8th prize is bbb!
The 9th prize is eee!
The 10th prize is aaa!

 

posted @ 2020-12-18 19:34  小鲨鱼2018  阅读(283)  评论(0编辑  收藏  举报