1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
-Dominant- [34]
3 years ago
10

The parent_directory function returns the name of the directory that's located just above the current working directory. Remembe

r 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
dir = os.getcwd()
relative_parent = os.path.join(dir, ___)
# Return the absolute path of the parent directory
return os.path.dirname(relative_parent)
print(parent_directory())
Computers and Technology
1 answer:
dedylja [7]3 years ago
6 0

Answer:

Following are the complete code to this question:

import os #import package  

def parent_directory():#defining a method parent_directory

   dir = os.getcwd()#defining dir that stores the getcwd method value  

   relative_parent = os.path.join(dir) #defining relative_parent variable that uses join method to adds directory

   return os.path.dirname(relative_parent)#use return keyword to return directory name

print(parent_directory())#use print method to call parent_directory method

Output:

/

Note:

This program is run the online compiler that's why it will return "/"

Explanation:

In the given Python code, we import the "os" package, after that a method "parent_directory" is defined, which uses the dir with the "getcwd" method that stores the current working directory.  

  • After that "relative_parent" variable is declared, which uses the join method to store the directory value and use the return keyword to returns its value.  
  • In the next step, the print method is used, which calls the method.
You might be interested in
Help me
mestny [16]

Answer:

  1. True
  2. False
  3. False
  4. True
  5. False

Explanation:

mark me as brainlyest

6 0
3 years ago
Have you ever had an incorrect perception about someone else?
Soloha48 [4]
Yes, all the time. Sometimes, it's feeling based. You get a bad vibe from someone, and you tend to go without without really giving said person a chance. Sometimes those vibes are helpful, sometimes it's you overreacting from bad experiences. (: hope all is well!
7 0
4 years ago
An expansion ____ is a long-narrow socket on the motherboard into which you can plug an expansion card.
Valentin [98]
The answer is
An expansion Slot
7 0
3 years ago
If ClassC is derived from ClassB which is derived from ClassA, this would be an example of ________.
finlep [7]

Answer:

Inheritance

Explanation:

8 0
3 years ago
Whereas enterprise network convergence focuses on the consolidation of traditionally distinct voice, video, and data communicati
Vinil7 [7]

Answer: Unified communication

Explanation: Unified communication is the communication technique in which merges various communication routines into a individual business.It works as the phone system which helps in increment of productivity in an organizational business.

The unifying of voice,data/information,video etc is done for optimizing and improving the business that also results in  faster communication rates, secure communication etc.

4 0
3 years ago
Other questions:
  • If Peyton Manning, a professional football player, wanted to remember his 16-digit credit card number, which of the following me
    5·1 answer
  • List and describe the three types of cloud models described by Microsoft.
    9·1 answer
  • You are replacing the toner cartridge for an old laser printer. You are concerned that several internal components are reaching
    8·1 answer
  • To pinpoint an earthquake's location, scientists need information from how many seismometers?
    8·1 answer
  • What is the Matlab command to create a vector of the even whole numbers between 29 and 73?
    11·1 answer
  • When would you use a template when working with word 2013?
    15·1 answer
  • 15. A mechanism by which other modules, such as I/O and memory, may interrupt the normal sequencing of the processor is called (
    13·1 answer
  • What is the output of the following code:
    12·1 answer
  • What is the main difference between a peripheral device and other types of devices? Choose the best answer.
    12·1 answer
  • Which of the following can be used to enter or display one complete row of information in a range or table without scrolling hor
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!