#๐Ÿ”’ Never coded before please help!

18 messages ยท Page 1 of 1 (latest)

rotund sandalBOT
#

@glacial tusk

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.

glacial tusk
#

Im using edublocks and never coded before trying to use if and elif statements to make a make shirt "personality" quiz thats very simple but I can't seem to get it to work properly please help!

tawdry narwhal
#

What error do you get?

#

Explain what you mean by : "I can't seem to get it to work properly please help!"

glacial tusk
#

I havn't gotten any error codes however when I put in a specific input I don't get the right text im looking for back if that makes sense?

manic jacinth
#

what input did you provide? what output did you expect and what did you get instead? pithink

glacial tusk
#

wait sorry never mind that was for my old code - I keep getting this error message - Traceback (most recent call last):
File "/lib/python312.zip/_pyodide/_base.py", line 597, in eval_code_async
await CodeRunner(
File "/lib/python312.zip/_pyodide/_base.py", line 411, in run_async
coroutine = eval(self.code, globals, locals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<exec>", line 35, in <module>
NameError: name 'Answer_2' is not defined. Did you mean: 'Answer_1'?

manic jacinth
#

it appears that there is an issue with undefined variables in your code. perhaps a simple indentation issue, or your code structure needs reworking

#

in ine 35, your are using Answer_2, but the Python interpreter does not know what that is up to that point

glacial tusk
#

ohh I see thank you, do you have any recommendations on how to fix this im a little confused rn srrry

tawdry narwhal
#
if Answer_1 in G:
  Answer_2 = ...
  if Answer_2 in H:
    Answer_3 = ...
    if Answer_3 in A:
      ...
  elif Answer_3 in B:
    ...
elif Answer_2 in T:
  ...
#

That's your code, minus the statements. Do you understand what you're seeing?

charred locust
#

!e

a = 1
if a == 2:
    b = 5

print(b)

You'll see this throw an exception saying b does not exist. This is the core of the problem you're seeing:

rotund sandalBOT
rotund sandalBOT
#
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.