Commit 1e9fbe07 by BellCodeEditor

save project

parent 7acfe91e
Showing with 9 additions and 3 deletions
...@@ -2,5 +2,11 @@ import random ...@@ -2,5 +2,11 @@ import random
q=input("请出拳:(石头/剪刀/布)") q=input("请出拳:(石头/剪刀/布)")
print("玩家出拳:"+q) print("玩家出拳:"+q)
a=['石头','剪刀','布'] a=['石头','剪刀','布']
o=random.choice(a)) o=random.choice(a)
print("计算机出拳:"+o) print("计算机出拳:"+o)
\ No newline at end of file if q==o:
print("平局")
elif q=="石头" and o=="剪刀" or q=="布" and o=="石头" or q=="剪刀" and o=="布":
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