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

I really need some help

Now I need you to write a function named absolute that takes two arguments, a path string and a root string. If the path is not already absolute, return the path with the root prepended to it.

For example: absolute("projects/python_basics/", "/") would return "/projects/python_basics/" while absolute("/home/kenneth/django", "C:\") would return "/home/kenneth/django".

absolute.py
import os
def absolute(path_string, root_string):
    path_string = 'projects/python_basics/'
    root_string = '", "/'
    return /projects/python_basics/

1 Answer

See this

I am not python expert so I googled it for you. By the way, if you want to get quick answers with some good explanations, copy the challenge text and google it. There are people who have asked and already solved it.