Commit ef8997a2 by BellCodeEditor

save project

parent 8b729148
Showing with 17 additions and 5 deletions
import random import random #调用随机数
wanjia=input("请出拳") play=input("请出拳:") #人机交互
list=["剪刀","石头","布"] list=["剪刀","布","石头"] #出拳集合
computer=random.choice(list) computer = random.choice(list) #从集合中随机出拳
print("玩家出"+wanjia+"电脑出"+computer) print("玩家出"+play+"电脑出"+computer) #输出出拳结果
if play in list:
if play==computer: #判断是否平局
print("平局哦")
elif (play=="剪刀" and computer=="布")or(play=="石头" and computer=="剪刀")or(play=="布"and computer=="石头"): #判断是否获胜
print("赢啦赢啦")
else:
print("你输啦")
else:
print("输入错误啦")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment