#๐Ÿ”’ why does it not delete out of the list.

28 messages ยท Page 1 of 1 (latest)

velvet mauve
#

when i run this code and i enter of the players names why does it not delete. DOes anyone see any problem?

brazen scrollBOT
#

@velvet mauve

Python help channel opened

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.

rare walrus
#

You're recreating that list each time you call the function.

velvet mauve
#

do i need to put the list than out of the function?

gaunt grove
#

how do you know it's not deleting?

rare walrus
#

That is one option.

velvet mauve
gaunt grove
rare walrus
#

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.

velvet mauve
gaunt grove
rare walrus
#

!e py def func(): v = 1 print(v) v = 0 func() print(v)

brazen scrollBOT
#

@rare walrus :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | 1
002 | 0
velvet mauve
#

i only call it once when the player is on the freeplayer position of the board

rare walrus
#

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.

velvet mauve
#

yea i see

#

it works now i put the list out of the function now it deletes

rare walrus
#

You're dealing with state. So you're knocking on the door of classes and/or databasing.

#

Good luck.

velvet mauve
#

thank you very much for your help

#

!close

brazen scrollBOT
#
Python help channel closed

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.