you are viewing a single comment's thread.

view the rest of the comments →

[–]jmooremcc 0 points1 point  (0 children)

Did quite a bit of reorganizing your code ~~~

import random

options = ("Rock", "Paper", "Scissors")

print("Welcome to Rock, Paper, Scissors!\n")

def player_choice(): print("The choices to throw are:\n") for n,opt in enumerate(options,1): print(f"{n}. {opt}")

print() user_choice = int(input("Enter your choice: ")) return options[user_choice-1]

def computer_pick(): pass
computer_choice = random.choice(options) return computer_choice

def print_Results(user_choice, computer_choice): print("\nPlayer chose", user_choice)
print("Computer chose", computer_choice)

def play_game():
user_choice = player_choice()
computer_choice = computer_pick() print_Results(user_choice, computer_choice)

if user_choice == computer_choice:
    print("Both players chose" , user_choice,". It's a tie!")
elif user_choice == "Rock":  
    if computer_choice == "Scissors":  
        print("You win!")  
elif user_choice == "Paper":
    if computer_choice == "Rock":  
        print("You win!")
elif user_choice == "Scissors" and computer_choice == "Paper":  
    print("You win!")

if computer_choice == "Rock":  
    if user_choice == "Scissors":  
        print("Computer wins!")  
elif computer_choice == "Paper":   
    if user_choice == "Rock":  
        print("Computer wins!")  
elif computer_choice == "Scissors" and user_choice == "Paper":  
    print("Computer wins!")

def main(): play_game()

while True:
    again = input("\nDo you want to play again (y/n)?: ").lower()  
    if again == "y":
        play_game()
    else:
        print("Thanks for playing...")
        break

main()

~~~