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

fotini komninou
fotini komninou
1,639 Points

python absolute path function

Hello Could someone explain what is wrong with the code?

absolute.py
import os

def absolute(r "p_path",r "r_root"):
    if os.path.isabs(r "p_path") ==True:
        print ""{}.format(r "p_path")""
    else:
        print ""{}.format(r "p_pathr"+r "r_root")""

1 Answer

Steven Parker
Steven Parker
229,644 Points

Here's a few hints:

  • function parameter names cannot be enclosed in quotes
  • the function must return the result
  • it does not need to "print" anything
  • you also won't need "format"
  • boolean values never need to be compared with "True" (just use them directly)