Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
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: