I’ll just point out a few issues I noticed, not sure exactly which one is causing your issue but just so you know, your casting a string (Text incased in “” or ‘’) into a string with the str(), you can remove that since its unneeded.
Second, your second input (p2), instead of using the random itself, you prompt the user for input, and prompting them with the message that is the random number it should instead be:
p2 = str(random.randint(1,3)
Now the issue that’s probably causing you the problem with the way the program works is the fact that each if is comparing a variable that is a string (user’s inputs are strings unless casted), to a int, which will always be false, So you need to either change the ints to strings (by encasing them with a “” or ‘’) or cast the variables into int (so p1 needs to become
Choose 1, 2 or 3:’’’))
and p2 would become
p2 = random.randint(1, 3)
also the code after the if’s has to be indented (CD removes this indent, you might have that it just doesn’t show)
I would suggest adding a if p1 == 1: print(‘okay it’s 1’) (properly formatted) after you get the input to p1. Then figure out why it’s not printing when you enter a 1. You also have the same problem with p2 (among other issues with that declaration).
Python is dynamically typed and strongly typed. If you’re coming from another language where that’s not the case, it can be confusing. To put it another way, what type of value do you think you’re storing in p1? What type of value are you comparing it to? And for p2, what does the input function do?
Also remember in python (x,y…) is a data type called a tuple, which works like a list (or array in other languages) except its immutable so you can’t change the values. I’m not sure if you want p1 and p2 to be stored as tuples but if you do, then you’ll want to use p1 to access the value the user typed. Otherwise you can remove the outermost set of parenthesis on both of your variables.
BTW, are you getting a syntax error popup rather than one logged in the console?
That isn’t a tuple though? Its just a single value wrapped in brackets ().
If you write the line
val = (3)
and then type(val)
it will return int, since this is just a order of operations, which is redundant but also won’t become a tuple (You need to list multiple elements for it to be a tuple)