# Rock-Paper-Scissors -- finished version.
# Run with: python projects/rock-paper-scissors/finished.py

import random

print("Choose rock, paper, or scissors: ", end="")
player = input()

# the computer picks one of three at random, without a list
roll = random.randint(1, 3)
if roll == 1:
    computer = "rock"
elif roll == 2:
    computer = "paper"
else:
    computer = "scissors"

print(f"The computer chose {computer}.")

if player != "rock" and player != "paper" and player != "scissors":
    print("That is not a valid choice.")
elif player == computer:
    print("It is a tie!")
elif (player == "rock" and computer == "scissors") \
        or (player == "paper" and computer == "rock") \
        or (player == "scissors" and computer == "paper"):
    print("You win!")
else:
    print("You lose!")
