1.strings...Pyhthon


#1




File "python", line 2
brian = "Hello life!"
^
IndentationError: unexpected indent


I dont know whats wrong with my indentation.(i've set it to 4 spaces)


# Set the variable brian on line 3
    brian = "Hello life!"


#2

why did you set the indent to 4 spaces? I don't see a reason you should do this, the indent should be zero spaces


#3

Thanks...on my first code i saw indentation error. then i set it to 4 spaces... I've seen the error


#4

indention is used to distinguish if clauses and so on:

test1 = "hello"
if True:
   test2 = "world"

now test2 is declared inside the if clause. test1 can't be indented, since it is part of an if clause (or anything else that requires indention)


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.