Commit 339b291c by BellCodeEditor

save project

parent b07d85ae
Showing with 11 additions and 8 deletions
...@@ -2,11 +2,14 @@ import random ...@@ -2,11 +2,14 @@ import random
list=("布","剪刀","石头") list=("布","剪刀","石头")
p=input("请出拳(石头/剪刀/布):") p=input("请出拳(石头/剪刀/布):")
suiji=random.choice(list) suiji=random.choice(list)
print("玩家出:"+p) if p in list:
print("电脑出:"+suiji) print("玩家出:"+p)
if p==suiji: print("电脑出:"+suiji)
print("平局") if p==suiji:
elif (p=="石头" and suiji=="布") or (p=="剪刀" and "石头") or (p=="布" and "剪刀"): print("平局")
print("你输了") elif (p=="石头" and suiji=="布") or (p=="剪刀" and "石头") or (p=="布" and "剪刀"):
print("你输了")
else:
print("你赢了")
else: else:
print("你赢了") print("输入错误")
\ No newline at end of file \ 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