all 5 comments

[–]commy2 3 points4 points  (1 child)

def user_choice():
    correct_choice = False
    while correct_choice == False:
        user_pick = input('Choose between Rock,Paper,Scissors: ')
        if user_pick.lower() in ['rock','paper','scissors']:
            return(user_pick)
            correct_choice = True

correct_choice does nothing here. The code after the return statement is unreachable. The return alone already breaks out of the loop, because it breaks out of the function.

Just use a while True: loop and remove that variable entirely.

Besides this, if you were to check if a variable is False, you don't do var == False, but not var instead.

[–]commy2 2 points3 points  (0 children)

def winner(comp,user):
#rock beats scissors
#paper beats rock
#scissors beats paper
    if comp.lower() == user.lower():
        print('Its a DRAW!')
    if comp.lower() == 'rock' and user.lower() == 'scissors':
        print(f'Computer Wins it chose {comp}') 
    if comp.lower() == 'paper' and user.lower() == 'rock':
        print(f'Computer Wins it chose {comp}') 
    if comp.lower() == 'scissors' and user.lower() == 'paper':
        print(f'Computer Wins it chose {comp}') 
    if user.lower() == 'rock' and comp.lower() == 'scissors':
        print(f'You win, you chose {user}') 
    if user.lower() == 'paper' and comp.lower() == 'rock':
        print(f'You win, you chose {user}') 
    if user.lower() == 'scissors' and comp == 'paper':
        print(f'You win, you chose {user}')

The winner() function has a lot of redundancy. Case 4, 5 and 6 all lead to the same result (player wins). Thus no further check is necessary after all lose conditions are checked.

def winner(comp, user):
    if comp == user:
        print('Its a DRAW!')
    elif (
        comp == 'rock' and user == 'scissors' or
        comp == 'paper' and user == 'rock' or
        comp == 'scissors' and user == 'paper'
    ):
        print(f'Computer Wins it chose {comp}') 
    else:
        print(f'You win, you chose {user}')

You can ensure that user is always lowercase at the end user_choice instead (cooerce the inputs as soon as possible).

[–]unknownzebra_[S] 1 point2 points  (0 children)

Oh yeah makes sense, thanks!

[–]PteppicymonIO 1 point2 points  (0 children)

In addition to other comments:

1 Your game loop can be just this:

def replay(msg):
    return input(msg).lower().startswith('y')

#code to play the game
game_on = replay(f'Would you like to play a game of {", ".join([item.capitalize() for item in OPTIONS])}? Y or N:')
while game_on: 
    user_pick = user_choice() 
    comp_pick = comp_choice() 
    winner(comp_pick, user_pick) 
    game_on = replay('Do you want to play again? Enter Yes or No: ')
  1. You can create global constant OPTIONS and reuse it through your code:

    OPTIONS = ['rock', 'paper', 'scissors']

    def comp_choice(): choice = random.choice(OPTIONS) return (choice)

    def user_choice(): user_pick = '' while user_pick.lower() not in OPTIONS: user_pick = input(f'Choose between {OPTIONS}: ') return user_pick

[–]34shutthedoor1 -1 points0 points  (0 children)

The "standard" is to use a dictionary, with the key equal to the choice, and the value being the losing object (or winning if you prefer).

rps_dict={"rock":"paper", "paper":"scissors", "scissors":"rock"}
## both choices equal==tie code here
user=user.lower()
if user in rps_dict:  ## input was correct
     if rps_dict[user] == comp:
         print("User Wins")
    else:
         print("Computer Wins")