用户:
老盛本人查看:0 回复:0 评论:0 创建时间:2020-04-06T19:08:15
【作品展示】

【作品介绍】
本作品基于random库制造
【作品源代码】
import random
suits = ["喵花", "方块", "红桃", "黑桃"]
faces = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"]
keep_going = True
while keep_going:
player_face = random.choice(faces)
player_suit = random.choice(suits)
computer_face = random.choice(faces)
computer_suit = random.choice(suits)
print("你抽到了", player_suit, player_face)
print("电脑抽到了", computer_suit, computer_face)
if faces.index(player_face) > faces.index(computer_face):
print("你赢了!✧*。٩(^㉨^*)و✧*。")
elif faces.index(player_face) < faces.index(computer_face):
print("电脑赢了!┏༼ •́ ╭╮ •̀ ༽┓")
else:
print("双方平局!(งಠ_ಠ)ง")
answer = input("按空格键+回车继续,按其他键退出:")
keep_going = (answer == " ")
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn