#๐ why does it not delete out of the list.
28 messages ยท Page 1 of 1 (latest)
@velvet mauve
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
You're recreating that list each time you call the function.
do i need to put the list than out of the function?
how do you know it's not deleting?
That is one option.
i tried it
and... what happened?
It is removing the entry. But that change is one without effect.
Because the list gets recreated within the function.
Presumably you have a free_players list outside this function?
You're dealing with scope.
yeah i think it's the code that was not shared that makes the problem clear: repeated calls of this function recreate the free_players list
!e py def func(): v = 1 print(v) v = 0 func() print(v)
@rare walrus :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | 1
002 | 0
i only call it once when the player is on the freeplayer position of the board
In this way, it's two different v variables.
Like two signposts labelled the same, but in different rooms.
Where you couldn't have multiple signposts of the same name in the same room.
You're dealing with state. So you're knocking on the door of classes and/or databasing.
Good luck.
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.