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 Technical Interview Prep: Python Basics Basic Python And I Will Try To Fix You

Joe Wingfield
seal-mask
.a{fill-rule:evenodd;}techdegree
Joe Wingfield
Python Development Techdegree Student 7,149 Points

Fix pep8 mistakes

I don't know why this isn't working, can someone help

pep.py
import datetime


def my_func():
    return 'It ran!'


sizes = ['small', 'medium', 'large']


class Tree:

    def __init__(self, size, characteristics):
        self.size = size
        self.charac = characteristics
        self.roots = True
        self.leaves = 0

    def grow_leaves(self):
        self.leaves += 1


Tree(sizes[0], {"name': 'Tulip Tree'})

2 Answers

Eugene Tkach
seal-mask
.a{fill-rule:evenodd;}techdegree
Eugene Tkach
Python Development Techdegree Student 1,591 Points

I'm very new to this but have some coding experience. Just started the course. Correct me if I'm wrong but have you checked your last line? It looks like your quotes are incorrect, you didn't close out your function correctly.

Joe Wingfield
seal-mask
.a{fill-rule:evenodd;}techdegree
Joe Wingfield
Python Development Techdegree Student 7,149 Points

Yeah I forgot to fix that but that's not why it's working. It's saying to put a blank line before a method and I've tried putting blank lines everywhere. Thank you though.

Megan Amendola
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Megan Amendola
Treehouse Teacher

Hi Joe Wingfield

I copied the code you have above and fixed the quote error on the last line that Eugene Tkach was talking about to be:

Tree(sizes[0], {'name': 'Tulip Tree'})

The code passes. Did you make any other changes to your code?

Joe Wingfield
seal-mask
.a{fill-rule:evenodd;}techdegree
Joe Wingfield
Python Development Techdegree Student 7,149 Points

Thank you for the help. I passed the challenge but something is confusing me. With the code above the bummer message said "add a blank line before a method", even though it should have said to fix the quote. I put the quote error there on purpose to try and see if the "blank line before a method error" would still overlap it, which it did. When I completed the code from scratch it would always say the same blank line error, but when I copy and pasted the code you provided it worked, even though I had the exact same thing you typed in, character for character. That's why I think that there might be an error with the challenge. Thank you for the help.