#๐ Never coded before please help!
18 messages ยท Page 1 of 1 (latest)
@glacial tusk
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.
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!
What error do you get?
Explain what you mean by : "I can't seem to get it to work properly please help!"
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?
what input did you provide? what output did you expect and what did you get instead? 
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'?
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
ohh I see thank you, do you have any recommendations on how to fix this im a little confused rn srrry
First, you have to understand how indentation works here:
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?
!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:
:x: Your 3.12 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 5, in <module>
003 | print(b)
004 | ^
005 | NameError: name 'b' is not defined
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.