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

FHATUWANI Dondry MUVHANGO
FHATUWANI Dondry MUVHANGO
17,796 Points

problems with starter.py

i know its a simple task, but way too frustrated because i cant get the space correct. i believe my spacing is right, but it keeps giving me errors that i cant even find

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

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're right. There are invisible characters that are giving the errors. It's counting the indentation as whitespace on lines that otherwise contain nothing else. This has to do with the way things auto-indent on a new line. And because you're so close here, I'm just going to give this hint. Put your cursor in the lines you believe are blank. I can almost guarantee you it won't be flush with the left side. Backspace to remove the additional whitespace that was added, and recheck the code. Pay close attention to the "Bummer!" messages as they are absolutely crucial to passing this challenge.

I hope this helps, but let me know if you're still stuck! :sparkles:

FHATUWANI Dondry MUVHANGO
FHATUWANI Dondry MUVHANGO
17,796 Points

Ok. I've tried your method I'm left with only one on line 13, that i definetly dont know how to fix. It keeps saying " no new line at the end of the file"

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Then you're at the end! Simply add a new line after the last line that you've typed. Be careful though, it might try to auto-indent so make sure you take out any of those pesky spaces that might have popped up so that the cursor is flush with the left side :thumbsup: