Rock paper scissors pt 2...
I'm trying to make a rock paper scissors game and so far I have this:
from random import randint
print("Rock...")
print("Paper...")
print("Scissors...")
player_wins = 0
computer_wins = 0
while player_wins < 3 and computer_wins < 3:
print(f"{computer_wins} to {player_wins}")
player1 = input("Player 1, make your move: ").lower()
computer_choices = ["rock", "paper", "scissors"]
computer_choice = randint(0, 2)
computer = [computer_choices[computer_choice]]
print(computer)
if player1 == computer:
print("It's a tie!")
elif player1 == "rock":
if computer == "scissors":
print("player1 wins!")
player_wins += 1
elif computer == "paper":
print("computer wins!")
computer_wins += 1
elif player1 == "paper":
if computer == "rock":
print("player1 wins!")
player_wins += 1
elif computer == "scissors":
print("computer wins!")
computer_wins += 1
elif player1 == "scissors":
if computer == "rock":
print("computer wins!")
computer_wins += 1
if computer == "paper":
print("player1 wins!")
player_wins += 1
else:
print("something went wrong")
Basically what I'm trying to do is have it take an input, pick a random choice, and then compare the choices. I have the first two parts down, where it picks a choice and takes the input, but it doesn't enter the if statements inside the while loop. It just keeps going forever.
What am I doing wrong here?
Aucun commentaire:
Enregistrer un commentaire