If you have any questions, comments or issues with this project please post them here!
In the common errors section,it is mentioned
“The moment you add the ()
you notice the color change of exit
from white to yellow.”
–Well, that happens only in dark mode, otherwise it is brown to blue
Also, in the example given, exit () leads to
repl process died unexpectedly:
Is that behaviour correct?
Yep, that’s normal. exit()
and equivalent functions in other languages will result in the same message. It’s just telling you the code didn’t finish running, it was stopped. I’m pretty sure the same message will show if you press the stop button up the top (which shows once you press run).
Hey there – loving the course so far. Wanted to ask – I did the logic with the if statements a bit differently as I didn’t nest inside the options for player 1 or player 2. I simply worked out all the different possibilities and since there aren’t that many, it didn’t create that much extra work.
Is there a problem with the logic in mine? https://replit.com/@evanaetor/day17100-days-rock-paper-scissors-continue#main.py
Nope, looks fine to me
New and improved
game!
https://replit.com/@JackAdem/Day-017-Project-17-Rock-Paper-Scissors-Multiple-Rounds?v=1
Day 17 of #Replit100DaysOfCode #100DaysOfCode.
print("ROCK, PAPER, SCISSORS")
print("======================")
print()
R = "rock"
P = "paper"
S = "scissors"
player1_score = 0
player2_score = 0
round = 0
while True:
round += 1
print("Round", round)
print("Select your move")
P1 = input("Player 1, select your option (R, P, S): ")
P2 = input("Player 2, select your option (R, P, S): ")
if P1 == P2:
print("It's a draw")
print("Try again")
elif (
(P1 == S and P2 == P) or
(P1 == R and P2 == S) or
(P1 == P and P2 == R)
):
print("Player 1 wins this round 👏")
player1_score += 1
elif (
(P2 == S and P1 == P) or
(P2 == R and P1 == S) or
(P2 == P and P1 == R)
):
print("Player 2 wins this round 👏")
player2_score += 1
print("Player 1 Score:", player1_score)
print("Player 2 Score:", player2_score)
continue
if player1_score >= 3:
print("Player 1 is the champion!")
break
elif player2_score >= 3:
print("Player 2 is the champion!")
break
print("Thanks for playing")
Hey, @borobert2322 welcome to the forums!
Can you please provide a link to the repl? This way it is easier for staff and members of the community to help you!
Also see this guide on how to share your code: