Commit ea296cbf by BellCodeEditor

save project

parent 88c31ab5
Showing with 13 additions and 3 deletions
...@@ -2,7 +2,17 @@ p=input("玩家猜拳 石头剪刀布") ...@@ -2,7 +2,17 @@ p=input("玩家猜拳 石头剪刀布")
print("玩家出:"+p) print("玩家出:"+p)
import random import random
d=["石头","剪刀","布"] d=["石头","剪刀","布"]
d=random.choice(d) if p in d:
d=random.choice(d)
print("电脑出:"+d)
#我们出拳结果:p 电脑出拳结果:d
if p==d:
print("平局")
elif p=="剪刀" and d=="布" or "石头" and d=="剪刀" or "布" and d=="剪刀":
print("玩家赢了!")
else:
print("电脑赢了!") 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