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
PLEASE HELP <br> Which of the following best describes the existence of undecidable problems?
Tju [1.3M]

Answer:

D.

Explanation:

Its the exact definition of an undecidable problem. Plus I have my notebook open next to me and that's what it says, trust bro.

7 0
3 years ago
What are the three fundamental elements of an effective security program for information systems?
marishachu [46]
<span>the three fundamental elements of an effective security program for information systems are Identification, Authentication and Authorization.The access control creates the user and assigns the rights to resources and authorization is giving permissions to the users to access the resources.The user who wants to enter the system should have a valid data t enter the system like password, fingerprint or any other type of recognition.</span>
4 0
3 years ago
Read 2 more answers
Alexa hoped that a good outline will accomplish which of the following for her<br> presentation?
atroni [7]

Answer: A. Help her distinguish between main topics and subtopics.

Explanation: APEX

6 0
3 years ago
Read 2 more answers
Consider an array inarr containing atleast two non-zero unique positive integers. Identify and print, outnum, the number of uniq
Delvig [45]

Answer:

Program.java  

import java.util.Scanner;  

public class Program {  

   public static boolean isPalindrome(String str){

       int start = 0, end = str.length()-1;

       while (start < end){

           if(str.charAt(start) != str.charAt(end)){

               return false;

           }

           start++;

           end--;

       }

       return true;

   }  

   public static int countPalindromePairs(String[] inarr){

       int count = 0;

       for(int i=0; i<inarr.length; i++){

           for(int j=i+1; j<inarr.length; j++){

               StringBuilder sb = new StringBuilder();

               sb.append(inarr[i]).append(inarr[j]);

               if(isPalindrome(sb.toString())){

                   count++;

               }

           }

       }

       return count == 0 ? -1 : count;

   }

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       String line = sc.next();

       String[] inarr = line.split(",");

       int count = countPalindromePairs(inarr);

       System.out.println("RESULT: "+count);

   }

}

Explanation:

OUTPUT:

3 0
3 years ago
Hilda is troubleshooting a problem with the encryption of data. at which layer of the osi reference model is she working?
Fittoniya [83]
The la<span>yer of the osi reference model that hilda is currently working on is: presentation
On Osi reference model, the presentation layer is created </span><span>to take care of the semantics and syntax of the information exchanged between two systems. The presentation layer will make sure that the receiver of the information will understand the data that being given.</span>
7 0
3 years ago
Other questions:
  • Type the correct answer in the box. Spell the word correctly. What aspect should you consider before adding pictures to a docume
    7·2 answers
  • An OS X backup utility that automatically backs up files to a dedicated drive that is always available when the computer is turn
    6·1 answer
  • Test if a number grade is an A (greater than or equal to 90). If so, print "Great!". Sample Run Enter a Number: 98 Sample Output
    7·1 answer
  • Which elements are in the Sort dialog box? Check all that apply.
    9·1 answer
  • How long does it take to send a 8 MiB file from Host A to Host B over a circuit-switched network, assuming: Total link transmiss
    11·1 answer
  • You are sending Secret information to a colleague located at another office. You want to give him some background information an
    15·1 answer
  • with the advent of technology one can experience special features such as 3D theater experiences true or false
    8·1 answer
  • Set of general format used to write program in any programming language?​
    10·1 answer
  • Pls need this asap
    14·2 answers
  • What can be used to help diagnose and fix computer hardware problems?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!