From 9f1829eea080fa1062c2088d5425a1c86859051d Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 26 Dec 2020 15:22:43 +0800 Subject: [PATCH] save project --- diy1.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 diy1.py diff --git a/diy1.py b/diy1.py new file mode 100644 index 0000000..e2ae166 --- /dev/null +++ b/diy1.py @@ -0,0 +1,21 @@ +# 玩家出拳 +while True: + choiceList = ["石头","剪刀","布"] + player = input("请猜拳(石头/剪刀/布):") + print("玩家出拳:"+player) + import random + if not player in choiceList: + print("不符合规矩") + continue + computer = random.choice(['石头','剪刀','布']) + print("电脑出拳:"+computer) + if player == computer: + print("平局") + elif player == "石头" and computer == "剪刀" or player == "剪刀" and computer == "布" or player == "布" and computer == "石头": + print("玩家胜出") + else : + print("很遗憾,电脑胜出") + key = input("是否继续?(任意键退出)") + if key != "是": + print("欢迎下一次使用") + break -- libgit2 0.25.0