#๐Ÿ”’ TypeError: argument of type 'function' is not iterable

30 messages ยท Page 1 of 1 (latest)

old flaxBOT
#

@supple vigil

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.

zenith vale
#

you forgot your ()

supple vigil
#

?

#

my message where my code was got deleted

#

it seems I can't even paste through the pastebin mentioned

#

Traceback (most recent call last):
File "main.py", line 175, in <module>
Game()
File "main.py", line 163, in Game
elif "_" not in attempt_bar:
TypeError: argument of type 'function' is not iterable

#

this was the error message

#

and what I was trying to do is verify if attempt_bar doesn't have the character "underscore" in it

zenith vale
#

did you expect attempt_bar to be a function?

#

I assume you did

supple vigil
#

no

zenith vale
#

so you should write elif "_" not in attempt_bar():

#

note the ()

#

you defined a function, and a variable inside it, with the same name ๐Ÿ˜

#

not a great idea

supple vigil
#

oh mb

zenith vale
#
   def attempt_bar():
      attempt_bar = []
supple vigil
#

how should I put it?

zenith vale
#

๐Ÿคท

#

however you like

supple vigil
#

without a variable I mean

zenith vale
#

just don't try to use the same name for two different things at the same time

supple vigil
#

oh ok

#

does attempt_bar_fun() works?

zenith vale
#

try it and see

supple vigil
#

ok, thank you :D

warped gazelle
#

Rather rename the list

#

and don't include the type of something in its name

old flaxBOT
#
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.