Commit 74acd382 by BellCodeEditor

save project

parent c90bde51
Showing with 8 additions and 5 deletions
...@@ -13,6 +13,7 @@ pen.end_fill() #结束填充红色 ...@@ -13,6 +13,7 @@ pen.end_fill() #结束填充红色
turtle.done() turtle.done()
''' '''
player = input("出拳(石头/剪刀/布):") player = input("出拳(石头/剪刀/布):")
print("玩家出拳" + player) print("玩家出拳" + player)
...@@ -21,10 +22,12 @@ list = ["石头","剪刀","布"] ...@@ -21,10 +22,12 @@ list = ["石头","剪刀","布"]
computer = random.choice(list) computer = random.choice(list)
print(computer) print(computer)
if (computer == "石头" and player == "布") or (computer == "布" and player == "剪刀") or (computer == "剪刀" and player == "石头"): if player in list:
if (computer == "石头" and player == "布") or (computer == "布" and player == "剪刀") or (computer == "剪刀" and player == "石头"):
print("你赢了") print("你赢了")
elif player == computer: elif player == computer:
print("平局") print("平局")
else: else:
print("失败") print("失败")
else:
\ No newline at end of file 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