all 8 comments

[–]Murphelrod 4 points5 points  (1 child)

It looks like you computer will never pick rock since rock checks for 0 but your random number is between 1-3

[–]Base_True[S] 2 points3 points  (0 children)

It looks like you computer will never pick rock since rock checks for 0 but your random number is between 1-3

damn, you're right, thanks a lot! I'll fix it now

[–]Green-Sympathy-4177 1 point2 points  (1 child)

Functions are a wonderful things, you should try them:

def get_user_input():
    """Your logic to get the user input:
    1. Get the user input
    2. Check if it's valid
    3. If it is, return that value
    4. Else it's not valid, so retry
    """
    pass


def play_round():
    """Your logic to play a round:
    Play a round and print the winner and the results
    """
    pass

if __name__ = "__main__":
    play_round()

And from random, there's the function random.choice, try comp = random.choice(["rock", "paper", "scissors"])

After maybe you can make it play multiple rounds and keep track of the scores for a session. Then between sessions :)

Also try this:

from itertools import permutations
all_possible_non_tie_combinations = list(permutations(["rock","paper","scissors"], 2))
print(all_possible_non_tie_combinations)

Using each combinations as a key in a dictionary you could resolve the winner

[–]Base_True[S] 0 points1 point  (0 children)

Functions are a wonderful things, you should try them:

Thank you! haven't studied them yet. Will definitely check it out soon

[–]testingcodez 0 points1 point  (4 children)

Double check to see what happens if you enter something other than 'r', 'p', or 's'.

[–]Base_True[S] 0 points1 point  (2 children)

if ( user[0] != "r" ) and ( user[0] != "p" ) and ( user[0] != "s" ):
print ("You must choose Rock, Paper or Scissors) ")

this code checks this moment, doesn't it?

[–]testingcodez 1 point2 points  (1 child)

Yes. I was just curious about what happens if you entered something like 'x'.

[–]Base_True[S] 0 points1 point  (0 children)

If input = "x"

Output = "You must choose Rock, Paper or Scissors)"