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
bagirrra123 [75]
3 years ago
6

Write an application that determines whether the first two files are located in the same folder as the third one. The program sh

ould prompt the user to provide 3 filepaths. If the files are in the same folder display All files are in the same folder, otherwise display Files are not in the same folder.
Computers and Technology
1 answer:
marissa [1.9K]3 years ago
5 0

Answer:

The program in Python is as follows:

fname1 = input("Filepath 1: ").lower()

fname2 = input("Filepath 2: ").lower()

fname3 = input("Filepath 3: ").lower()

f1dir = ""; f2dir = ""; f3dir = ""

fnamesplit = fname1.split("/")

for i in range(len(fnamesplit)-1):

   f1dir+=fnamesplit[i]+"/"

fnamesplit = fname2.split("/")

for i in range(len(fnamesplit)-1):

   f2dir+=fnamesplit[i]+"/"

fnamesplit = fname3.split("/")

for i in range(len(fnamesplit)-1):

   f3dir+=fnamesplit[i]+"/"

if f1dir == f2dir == f3dir:

   print("Files are in the same folder")

else:

   print("Files are in the different folder")

Explanation:

The next three lines get the file path of the three files

<em>fname1 = input("Filepath 1: ").lower()</em>

<em>fname2 = input("Filepath 2: ").lower()</em>

<em>fname3 = input("Filepath 3: ").lower()</em>

This initializes the directory of the three files to an empty string

f1dir = ""; f2dir = ""; f3dir = ""

This splits file name 1 by "/"

fnamesplit = fname1.split("/")

This iteration gets the directory of file 1 (leaving out the file name)

<em>for i in range(len(fnamesplit)-1):</em>

<em>    f1dir+=fnamesplit[i]+"/"</em>

This splits file name 2 by "/"

fnamesplit = fname2.split("/")

This iteration gets the directory of file 2 (leaving out the file name)

<em>for i in range(len(fnamesplit)-1):</em>

<em>    f2dir+=fnamesplit[i]+"/"</em>

This splits file name 3 by "/"

fnamesplit = fname3.split("/")

This iteration gets the directory of file 3 (leaving out the file name)

<em>for i in range(len(fnamesplit)-1):</em>

<em>    f3dir+=fnamesplit[i]+"/"</em>

This checks if the file directories hold the same value

This is executed, if yes

<em>if f1dir == f2dir == f3dir:</em>

<em>    print("Files are in the same folder")</em>

This is executed, if otherwise

<em>else:</em>

<em>    print("Files are in the different folder")</em>

You might be interested in
Which of these statements about tags is false?
Elenna [48]

Answer:

LOL i don't even know

Explanation:

3 0
2 years ago
Which of the following statements is true of intrapreneurs
chubhunter [2.5K]

<u>Answer is:</u>

They take risks, but not with their own investments.

<u>Explanation:</u>

Intrapreneurship is the act of behaving like an entrepreneur while working within a large organization. Intrapreneurship is known as the practice of a corporate management style that integrates risk-taking and innovation approaches, as well as the reward and motivational techniques, that are more traditionally thought of as being the province of entrepreneurship.


<u>Example:</u>

One of the most well-known examples of intrapreneurship is the "Skunk Works" group at Lockheed Martin. The group was originally named after a reference in a cartoon, and was first brought together in 1943 to build the P-80 fighter jet. Because the project was to eventually become a part of the war effort, the project was internally protected and secretive. Kelly Johnson, later famous for Kelly's 14 rules of intrapreneurship, was the director of this group.

4 0
3 years ago
In 3-5 sentences, describe how you would insert a graph in your word-processing document.
Allisa [31]

Answer:

Click the “Insert” tab, then click the “Chart” button on the Illustrations section to open the “Insert Chart” pop-up window.

Select the type of graph to add to the document, such as a pie chart or bar graph. ...

Click “OK” and Word adds a chart with generic data points to the document.

Explanation:

3 0
3 years ago
Which statement describes the relationship between science and technology?
Elden [556K]
Answer: science is the study of the world, and technology changes the world to solve problems.
3 0
2 years ago
Read 2 more answers
Pseudocode is an improvement over the IPO chart because it lays out the a0 sequence of steps for a particular program.
Olegator [25]

Answer:

Yes. Pseudocode is an improvement over the IPO chart because it lays out the sequence of steps for a particular program

Explanation:

The input–process–output (IPO) chart is a widely used approach in systems analysis and software engineering for describing the structure of an information processing program or other process. The chart has three components (Input, Process and Output), and you write the description of each component in plain English, not code or mathematical formulas.

Pseudocode is a procedure for solving a problem in terms of the actions to be executed and the order in which those actions are to be executed.

Pseudocode is an improvement over the IPO chart because it shows the step by step sequence to be followed by a particular program unlike the IPO chart which just break the program into Input, Process and Output.

6 0
3 years ago
Other questions:
  • Press the _______ key to move to the next cell in a row.
    12·2 answers
  • How do you interpret field in contest of a DBMS?
    5·1 answer
  • Drag the tiles to the correct boxes to complete the pairs.
    13·1 answer
  • An inventory management system that goes beyond just managing inventory to act as a complete distribution system (including inve
    10·1 answer
  • Suppose that a computer can read or write a memory word in 5 nsec. Also suppose that when an interrupt occurs, all 32 CPU regist
    10·2 answers
  • I'm having trouble changing my google account password
    12·1 answer
  • JUST NEED TO KNOW WHO ALL DOSE EDGINUITY
    12·2 answers
  • Hey! PLEASE HELP!!!
    12·1 answer
  • Using computers can lead to a number of physical safety issues. State and explain TWO(2) of these types of issues.​​​​​
    12·1 answer
  • Global communication and transportation technologies are an example of a(n) ____
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!