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 Python for File Systems Navigation Absolutely

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 36,143 Points

Need some feedback. Why doesn't this work?

The "Bummer. Try again" response tells me nothing about how to fix this so I can get past the exercise. I really wish it would at least provide a hint. I hope someone will respond. I understand the principles here, so it's frustrating to be stuck on something that is apparently very simple.

absolute.py
import os

def absolute(path, root):
    if os.path.isabs(path) == False
        path.prepend(root)
    return path

3 Answers

Steven Parker
Steven Parker
231,236 Points

Here's a few hints:

  • "if" statements should end with a colon (":")
  • strings don't have a "prepend" method (you might try using concatenation with the "+" operator)
  • strings are immutable and string operations must be assigned to a variable to be retained
Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 36,143 Points

Crap. I left the colon off. That was all it was. I've been working with multiple languages and these things occasionally get past me. Thanks for the help. D'oh.

Steven Parker
Steven Parker
231,236 Points

Wait .. that "prepend" method works?

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 36,143 Points

No sorry. I changed that too. It didn't notice that the site started me on step 1 of 2. I changed the prepend to concatenation to pass Step 2.

Steven Parker
Steven Parker
231,236 Points

Thought maybe they'd snuck in a new method on me for a moment. :wink: