Why don’t change the list element ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why don’t change the list element ?

https://sololearn.com/compiler-playground/cgjEks7MdL8X/?ref=app Here: if player == 1 and scelta_casella == 1: mosse += 1 casella[0] = "❌"

21st Dec 2023, 4:04 PM
Nicola
Nicola  - avatar
2 Answers
+ 1
卂ㄚㄩ丂卄 i solved! the problem was the player int input, becouse i assign an character to an int
21st Dec 2023, 4:44 PM
Nicola
Nicola  - avatar
0
The reason the list element may not be changing as expected could be due to the fact that you are comparing player to 1, and in your code, player is assigned the value entered by the user. The input is read as an integer, so you should compare player to 1 without converting it to an integer. Here's the corrected part of the code: if player == 1 and scelta_casella == 1: mosse += 1 casella[0] = player_symbol
21st Dec 2023, 4:12 PM
卂ㄚㄩ丂卄
卂ㄚㄩ丂卄 - avatar