Hello, I am asked to write down a rock, paper, scissors game for school but whenever I type my decision like rock I always end up winning, and don’t lose. Not sure what is wrong.
Please don’t post screenshots; post the code, select it, and then click the </> button.
The problem is caused by the line:
computer = random.randint, var123,
computer will be a tuple that consists of the function random.randint and the value of var123.
random.choice would be a better choice. It’s in the docs.
Both random.randint and random.choice are functions that you should call. You’re not calling them, you’re making a tuple.
Yes, because it still means “make a tuple that contains two items: the function, and the var123 variable”, and does not mean “call the function, passing var123 as an argument”.
Put it another way - suppose I wrote this code:
users_pick = input, "-Hello, and welcome to Rock, Paper, Scissors.",
What’s wrong there?
there are no brackets, so would it be, computer = random.choice (var123)
You need to call random.choice, just as you are calling print:
computer = random.choice(var123)
If I had to guess, I’d say you are thinking “textually”, and that
computer = random.choice, var123,
would somehow combine the text used to define var123 to produce the function call, as if you had literally typed
computer = random.choice("paper", "rock", "scissors")
But that isn’t how Python works (and even if it were, you would be missing a pair of parentheses, because the correct call would be
computer = random.choice(("paper", "rock", "scissors"))
)

