Commit 0a2f2d1d by BellCodeEditor

save project

parent 12c721a2
Showing with 15 additions and 4 deletions
...@@ -2,6 +2,18 @@ ...@@ -2,6 +2,18 @@
a1=input("请你出拳,石头,剪刀,布") a1=input("请你出拳,石头,剪刀,布")
print("玩家出拳"+a1) print("玩家出拳"+a1)
import random import random
a2=["石头","剪刀","布"] a3=["石头","剪刀","布"]
a3=(random.choice(a2)) a2=(random.choice(a3))
print("电脑出:"+a3) print("电脑出:"+a2)
\ No newline at end of file if a1==a2:
print("平局")
elif a1=="剪刀" and a2=="布":
print("玩家赢了")
elif a1=="布" and a2=="石头":
print("玩家赢了")
elif a1=="石头" and a2=="剪刀":
print("玩家赢了")
else:
print("电脑赢了")
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