Commit 510e9b0a by BellCodeEditor

save project

parent b1544272
Showing with 13 additions and 9 deletions
...@@ -5,13 +5,16 @@ import random ...@@ -5,13 +5,16 @@ import random
list=["石头","剪刀","布"] list=["石头","剪刀","布"]
b=random.choice(list) b=random.choice(list)
print("电脑:"+b) print("电脑:"+b)
if b==play: if play in list:
print("平局") if b==play:
elif b=="剪刀"and play=="石头" print("平局")
print("赢了") elif b=="剪刀"and play=="石头"
elif b=="石头"and play=="布" print("赢了")
print("赢了") elif b=="石头"and play=="布"
elif b=="布"and play=="剪刀" print("赢了")
print("赢了") elif b=="布"and play=="剪刀"
print("赢了")
else:
print("输了")
else: else:
print("输了") 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