11 space tab when I press the RETURN key


#1

Hi All,

I have seen this twice now when I am coding: I finish a line of code and then I press the return key to go to the next line and it indents to the next line 11 spaces. Why is this?

Thanks,

Eric


#2

This is an assist function. Altho it can be a bit annoying sometimes, it would be more annoying f you had to place these spaces yourself. Imagine putting 3 spaces yourself for the whole code while Codecadamy expects 4 spaces.

The lesson wont clear because the wrong amount of spaces are given. This could lead to alot of questions of “why is my code not clearing the lesson”.


#3

Hi Biirra,

Thanks for that. The 11 spaces are clearly wrong because inside my while loop (for example) im expecting to indent just two spaces for the next line, so I have to delete 9 spaces every time (or I have to delete the whole eleven spaces if it needs to be on the same indent).

And why eleven spaces?

Am I doing something wrong?

Thanks,

Eric


#4

as far as i noticed.

whenever your line ends with : it should indent itself with a few extra spaces.

For example:

class test:
    def example():
        if(something < somethingelse):
            print result    #is done if the if statement returns true.
        print result     #is done when the function example() is called. This is not part of the if block.

As you can see the indentation is way beyond 4 spaces in the if statement. Python does this so it knows what is part of a certain block of code.


#5

im familiar with the automatic indent of 2 spaces within the codecademy environment. its just the 11 spaces that confuses me. its bothersome. I have to delete all 11 or 9 spaces to get back to the indent i need to get to.

is this a bug?

thanks

Eric


#6

That could be a possibility.
This post explains how you should handle bugs.


#7

Okidok, thanks for your prompt responses.