Last active
March 23, 2022 09:07
-
-
Save manero6/b5e280d0307692d8f76a5d61ea913c68 to your computer and use it in GitHub Desktop.
The parent_directory function returns the name of the directory that's located just above the current working directory. Remember that '..' is a relative path alias that means "go up to the parent directory". Fill in the gaps to complete this function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def parent_directory(): | |
# Create a relative path to the parent | |
# of the current working directory | |
relative_parent = os.path.join("..") | |
# Return the absolute path of the parent directory | |
return os.path.abspath(relative_parent) | |
print(parent_directory()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using only the methods mentioned in the course