Skip to content

Instantly share code, notes, and snippets.

@manero6
Last active March 23, 2022 09:07
Show Gist options
  • Save manero6/b5e280d0307692d8f76a5d61ea913c68 to your computer and use it in GitHub Desktop.
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.
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())
@manero6
Copy link
Author

manero6 commented Mar 22, 2022

Using only the methods mentioned in the course

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment