What did i do wrong?

What did i do wrong?

Other urls found in this thread:

docs.python.org/2.7/tutorial/controlflow.html#if-statements
twitter.com/NSFWRedditImage

You used codecademy

Need to close parens on line 5. Fix your indent.

Need to define the character as a string. str( ).

You took a picture with your phone rather than a screenshot

I already tried removing .upper () all together and did close it. The problem is on line 6

Fucking newfags...

Fix indent, like this user said.

Ignore the guy who doesn't know much about variables in python.

Fix your identation and write a return somewhere in the function. It won't work without a return

>calls us knew fags
>doesn't even know what the problem is

indentation you faglord

>Knew fags

Fucking newfag

>doesn't even know what the problem is

Projecting this hard

you should only do indent with tab.

answer = raw_input('foobar').upper()

So, what's the problem with OP's code then?

dim \ Initialize string "Answer' correct

>What did i do wrong?
As user said:

Update: fixed line 6, now the problem is on line 9.

Error: unindent does not match any outer indentation level

selfbump

>python 2
>codecademy
that's what you did wrong

match the fucking identations, you niggerfaggot

if you can't figure that out, kys

Newfag

TopKek

this guy thinks that codecademy will make him the next Larry Page

itt: the OCD scripting language

Watch your indents.

Matched indentations but now it took me back to line 6. answer is already defined though?

answer is not global. Just put the whole damn thing into the function.

>he matched the identations outside of the function

Indent lines 6, 9, 12

Check the log window. The problem is on the colon character in the end of the first condition

>trying to program
>too stupid to use the print scr button

It is damn Python. You have to use tabs and whitespaces to align all elements as usual.

def
-> print
-> answer
-> if
-> -> print
-> elif
-> -> print
-> else
-> -> print

>Newfag can't greentext

Is this a troll?
Must be a troll. I haven't coded in 8 years and know no python but you can't figure it out even though the program is literally telling you.

Also, your indentation is still wrong. Looks like you have no idea what it actually does. Do a beginners tutorial or something.

>implying he's greentexting

Not sure if troll is trying to be meta or not even trying at all

The scope of the answer variable is not ok because of identation

THIS IS WHY YOU DON'T FUCKING USE CODEACADEMY.

THEY JUST STRAIGHT INTO THE PRACTICALS WITHOUT TELL YOU HOW EVERYTHING WORKS.

YOU ALSO HAVE TO PAY FOR SOME TUTORIALS TOO, FUCK THAT.

will that ever be true though?

even if you answer "a", it will be turned into "A" by .upper()

>there isn't even bait on the hook
i always wondered wether that was intentional or the creator of the pic was just an idiot. tended to lean towards the latter though

Declare answer before the function.

Google it : docs.python.org/2.7/tutorial/controlflow.html#if-statements

I bet the paid ones also suck hard

You chose b or c

Best thing would be to read a book. I heard Automate Python is pretty good, but I've never studied Python.

This tbh

OP, white space is important in python. Everything 'within' the function needs to be indented one more past where "def" is

Also, another issue here is that the conditionals should have the letters in uppercase, so: if "A", elif "B" or "C", else...

I'm not a coder and even I can figure this shit out.
I'm pretty sure you're not cut out for this kiddo.

I've dealt with "Beginning Python" by Magnus Die Hetland and "Learn Python The Hard Way". Both are solid recommendations from me, if you want to get into python.

You too, dumbass

Answer is only defined within your the_flying_function function. Outside of that function, answer does not exist. It is not a global variable.

OP here

selfbump

Well, did you?

You dont now a bit

I think that when dealing with functions, something should be returned. I don't know about this particular exercise, but what I would do is to have the function return the answer, and then have a variable that is equal to the function:

def penis:
if a:
return x
elif b or c:
return y
else:
return z

Then outside of the function:

result = penis

if result == "x":
print ""

elif result == "y":
print ""

else:
print ""

what should he use

Python 3.5, and a book like Automate Python or another good one. Avoid Learn Python The Hard Way.

Ich bin auf lehrgang wieder in den nächsten Tagen noch nicht mal mehr als ein paar Bilder vom Flughafen entfernt werden die Daten von der Arbeit mit dem Zug nach der Geburt des Tages vom Flughafen abholen

>bash script
>VI

Born

ABZ