From 422a3e1df15a04321ab36c90c2cb12b156ea4d60 Mon Sep 17 00:00:00 2001 From: Coding Capricorn Date: Mon, 10 Oct 2022 13:31:41 +0530 Subject: [PATCH 1/4] Create Rock, Paper, Scissor game rps.py Rock, paper and scissor game using Python --- rps.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 rps.py diff --git a/rps.py b/rps.py new file mode 100644 index 00000000..231e2458 --- /dev/null +++ b/rps.py @@ -0,0 +1,36 @@ +from random import randint + +#create a list of play options +t = ["Rock", "Paper", "Scissors"] + +#assign a random play to the computer +computer = t[randint(0,2)] + +#set player to False +player = False + +while player == False: +#set player to True + player = input("Rock, Paper, Scissors?") + if player == computer: + print("Tie!") + elif player == "Rock": + if computer == "Paper": + print("You lose!", computer, "covers", player) + else: + print("You win!", player, "smashes", computer) + elif player == "Paper": + if computer == "Scissors": + print("You lose!", computer, "cut", player) + else: + print("You win!", player, "covers", computer) + elif player == "Scissors": + if computer == "Rock": + print("You lose...", computer, "smashes", player) + else: + print("You win!", player, "cut", computer) + else: + print("That's not a valid play. Check your spelling!") + #player was set to True, but we want it to be False so the loop continues + player = False + computer = t[randint(0,2)] From cf3526c79c597405418909113e381b1a9e1df0e3 Mon Sep 17 00:00:00 2001 From: Coding Capricorn Date: Sun, 17 Nov 2024 12:20:08 +0000 Subject: [PATCH 2/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f63240e9..918e0a6e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Steps to contribute in this repository - 1. Fork this repo + 1. Fork this repo . 2. Propose/Update (C++/Java/Python) file of your choice 3. Add useful code for the open-source community 4. Make pull request From e8ca695d909c87b51914f8dcfef8d3c0975a33b7 Mon Sep 17 00:00:00 2001 From: Coding Capricorn Date: Sun, 17 Nov 2024 12:20:19 +0000 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 918e0a6e..9ff422a1 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Steps to contribute in this repository - 1. Fork this repo . + 1. Fork this repo .. 2. Propose/Update (C++/Java/Python) file of your choice 3. Add useful code for the open-source community 4. Make pull request From 80b81212aa365d342fd7d212c83290df0aee4605 Mon Sep 17 00:00:00 2001 From: Coding Capricorn Date: Sun, 17 Nov 2024 12:20:31 +0000 Subject: [PATCH 4/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ff422a1..f2b875ad 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Steps to contribute in this repository - 1. Fork this repo .. + 1. Fork this repo 2. Propose/Update (C++/Java/Python) file of your choice 3. Add useful code for the open-source community 4. Make pull request