0

Can anyone find out how to fix the syntax error

I don’t know how to fix the syntax error https://code.sololearn.com/c06EYP384pxv/?ref=app

13th Jun 2021, 10:41 PM
A G
A G - avatar
1 Risposta
+ 2
I adjusted a few things in your code. The syntax issue was caused by the types of inputs you are comparing. You have placed your random choice items in a list, so they need to be represented as such in line 22. I also trimmed your input to get a clean interface on Sololearn, and I removed the indentation of print(play()) so it would call. # input 'r', 'p', or 's' import random def play(): user = input() computer = random.choice(['r', 'p', 's']) if user == computer: return 'tie' {} if is_win(user, computer): return 'you won' return 'you lost' def is_win(player, opponent): if (player == 'r' and opponent == ['s']) or (player == 's' and opponent == ['p']) or (player == 'p' and opponent ['r']): return True print(play())
13th Jun 2021, 11:22 PM
Rik Wittkopp
Rik Wittkopp - avatar