0

Python code help

I'm making a text based game, and at some point i want to make a random choice something from a list, but each one of the things in the list give you +1 point or -1 point. Example: list = ['hello', 'bye', 'good night'] x = random.choice (list) print(x) and here o wanted to do something like If x = First thing of the list, then points +1 or If x = Second thing in the list, then -1 points i tried to do It like If x = (list[0]) points = points +1 but It says "invalid sintax" on the 'if' line, i tried It for Manu diferent ways but It still don't work... pls Help me

28th Jul 2018, 11:32 AM
Kisune
Kisune - avatar
3 Answers
+ 6
After if you need to end the line with : And use == when you compare two values.
28th Jul 2018, 11:37 AM
Paul
Paul - avatar
+ 1
Nos if vocĂȘ tem que pĂŽr "=="
28th Jul 2018, 8:28 PM
I Am Arthur
I Am Arthur - avatar
+ 1
E tem que dar "import random" pra depois fazer o "random.choice"
28th Jul 2018, 8:29 PM
I Am Arthur
I Am Arthur - avatar