0

Here is my code

user_action = input("enter rock, paper, or scissors:  ")
possible_action = ["rock", "paper", "scissors"]
computer_action = random.choice(possible_action)

and it tells me that it's an invalid variable.

Am I doing something wrong or is it Pydroid's fault?

Anton Menshov
  • 2,266
  • 14
  • 34
  • 55

1 Answers1

1

The only possible issue is that you forgot to

import random

This code is working perfectly fine:

import random
user_action = input("enter rock, paper, or scissors:  ")
possible_action = ["rock", "paper", "scissors"]
computer_action = random.choice(possible_action)
print(computer_action)
AS11
  • 1,311
  • 1
  • 7
  • 17