基本信息
源码名称:石头剪刀布游戏最简单python源码
源码大小:0.61KB
文件格式:.py
开发语言:Python
更新时间:2021-04-01
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
import random count = 3 while count: a = input("请出拳(石头、剪刀、布):") b = ["石头","剪刀","布"] win_list = [["石头","剪刀"],["剪刀","布"],["布","石头"]] mac = random.choice(b) print("你出拳:",a) print("电脑出拳:",mac) if a in b : count-=1 if a == mac: print("平局") elif [a,mac] in win_list: print("恭喜!你赢了") count =1 else: print("很遗憾!你输了") else: print("你的输入有误") print("你还剩余机会:",count)