Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Write Better Python Cleaner Code Function and Class Whitespace

What's wrong with my indentation?

This is suppose to be an easy quiz to fix indentation, what am i doing wrong?

starter.py
def first_function(arg1):
    return 'arg1 is {}'.format(arg1)


def second_function(arg1):
    return 'arg1 is {}'.format(arg1)


class MyClass:
    args = [1, 2, 3]


def class_func(self):
    return self.args

1 Answer

Jennifer Nordell
STAFF
Jennifer Nordell
Treehouse Teacher

Hi there! I think you're doing pretty well here, but the instructions mention a class method. Remember, a method is a fancy name for function defined inside a class which means it should be indented under class. Also, your file will need a blank line at the end. It's hard to say if you've put one and it's just truncated here or not, but it will be required. Keep this in mind too as you make these corrections, that when you hit enter or return to go to the next line, because of the auto-indent feature happening you can end up with some extra whitepsace on what appears to you to be a blank line. The line must be completely blank without any tabs or spaces. So if you get a Bummer! saying there's whitespace on a blank line, that's what it means. I feel like you can get it with these hints, but let me know if you're still stuck! :sparkles: