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
Congress are smart becuase.....
spin [16.1K]

Answer:

If we are talking about government then they are smart bc of there two house policies, both are equal yet super unique. They make sure each state has an equal voice in the senate.

5 0
3 years ago
In what ways are computers being used to improve our quality of life
Helga [31]

Answer:

  • computers help with our education system
  • communicating with others is easier (emails/text messages opposed to sending an envelope)
  • technological advances

5 0
3 years ago
Read 2 more answers
A low-level language has a low level of ___________ because it includes commands specific to a particular cpu or microprocessor
Studentka2010 [4]
Command Specifics to a cpu or a microprocessor it is code <span />
7 0
4 years ago
Given the following Area class, how would I call the calcAreaSquare method in AreaTest.java with square with side length of 6? p
Olin [163]

Answer:

You can call the static method using the following statement:

double area = Area.calcAreaSquare(3.5);

Explanation:

In  Java, a static method can be called by directly using the Area class name and followed with a dot syntax as shown above. This will invoke the calcAreaSquare() method and act on the input 3.5 and return the output to the variable area.  

Calling a static method doesn't need to go through a class instance.  

3 0
4 years ago
What to take for ptsd
REY [17]
Dank memes and medicine
6 0
4 years ago
Read 2 more answers
Other questions:
  • Ron frequently uses the word improving in his blog. He types the word imp and the word improving appears. Which feature of his s
    6·2 answers
  • A(n) combines video instruction and interaction with an instructor and students in an online classroom.
    9·1 answer
  • How far is florida from oklahoma?
    10·2 answers
  • Which best describes IMEI?
    7·1 answer
  • IN JAVA Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin ty
    15·1 answer
  • The exponential distribution is often used to model what in a queuing system?
    12·1 answer
  • Disk mirroring is a method of storing data that generates extra bits of data from existing data, allowing the system to create a
    14·1 answer
  • The following are the CPU and I/O behavior of three processes, timings in seconds.
    9·1 answer
  • Why is it a good idea to restate in your own words what you heard someone say? It can reduce the chances of a miscommunication.
    11·1 answer
  • when you enter a url, you’re creating a(n) ____ link, which is the full and complete address for the target document on the web.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!