Commit 7afb1c28 by BellCodeEditor

save project

parent de19778f
Showing with 25 additions and 22 deletions
...@@ -5,24 +5,27 @@ import random ...@@ -5,24 +5,27 @@ import random
list1=["石头","剪刀","布"] list1=["石头","剪刀","布"]
computer=random.choice(list1) computer=random.choice(list1)
print("计算机出",computer) print("计算机出",computer)
if player=="石头": if player in list1:
if computer=="石头": if player=="石头":
print("平局") if computer=="石头":
elif computer=="剪刀": print("平局")
print("玩家赢") elif computer=="剪刀":
elif computer=="布": print("玩家赢")
print("计算机赢") elif computer=="布":
if player=="剪刀": print("计算机赢")
if computer=="石头": if player=="剪刀":
print("计算机赢") if computer=="石头":
elif computer=="剪刀": print("计算机赢")
print("平局") elif computer=="剪刀":
elif computer=="布": print("平局")
print("玩家赢") elif computer=="布":
if player=="布": print("玩家赢")
if computer=="石头": if player=="布":
print("玩家赢") if computer=="石头":
elif computer=="剪刀": print("玩家赢")
print("计算机赢") elif computer=="剪刀":
elif computer=="布": print("计算机赢")
print("平局") elif computer=="布":
\ No newline at end of file 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