From 619a9bc1eaeb53049261d7dd11acb05cb82fe952 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 30 Aug 2020 20:14:38 +0800 Subject: [PATCH] save project --- diy1.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/diy1.py b/diy1.py index 5ab8e1e..df4141f 100644 --- a/diy1.py +++ b/diy1.py @@ -2,16 +2,18 @@ import random player=input("paper,scissors......(paper/scissors/rock)") print("player:"+player) list=["paper","scissors","rock"] -if -com=random.choice(list) -print("computer:"+com) -if player==com: - print("We are the same.") -elif player =="rock" and com == "scissors": - print("You win!") -elif player =="scissors" and com == "paper": - print("You win!") -elif player =="paper" and com == "rock": - print("You win!") -else: - print("You lose!") \ No newline at end of file +if player in list: + com=random.choice(list) + print("computer:"+com) + if player==com: + print("We are the same.") + elif player =="rock" and com == "scissors": + print("You win!") + elif player =="scissors" and com == "paper": + print("You win!") + elif player =="paper" and com == "rock": + print("You win!") + else: + print("You lose!") +else: + print("It's wrong.") \ No newline at end of file -- libgit2 0.25.0