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 phrases in the passage provide clues that trifling means "silliness” or "insignificance”? Check all that apply.
Alla [95]

Answer:

a c e

Explanation:

8 0
2 years ago
CAN SOMEONE PLEASE PLEASE HELP ME OUT !!!!
34kurt

Answer:the answer is A

Explanation: develop a test to see what kind of circuits it takes to power a oven

4 0
3 years ago
What is the output of 1101×10==11000+10
aliya0001 [1]

Answer:

west ward cpt output

Explanation:

i know because i invented it

6 0
3 years ago
Series-connected 11-pF and 21-pF capacitors are placed in parallel with series-connected 22- pF and 30-pF capacitors. Determine
Naya [18.7K]

Answer:

19.9 pF

Explanation:

Given that:

Series connection :

11pF and 21pF

C1 = 11pF ; C2 = 21pF

Cseries = (C1*C2)/ C1 + C2

Cseries = (11 * 21) / (11 + 21)

Cseries = 7.21875 pF

C1 = 22pF ; C2 = 30pF

Cseries = (C1*C2)/ C1 + C2

Cseries = (22 * 30) / (22 + 30)

Cseries = 12.6923 pF

Equivalent capacitance is in parallel, thus,

7.21875pF + 12.6923 pF = 19.91105 pF

= 19.9 pF

8 0
3 years ago
SHOW ME SOME C++ TUTORIALS?
german
Google c++ tutorial. Cplusplus and Tutorials Point both have some good resources
4 0
3 years ago
Other questions:
  • Write a program that displays the following pattern: ..\.\* .\.\*** \.\***** ******* \.\***** .\.\*** ..\.\* That is, seven line
    8·1 answer
  • Apple was a pioneer in user interface development, introducing the _____, complete with mouse and screen icons, in the early 198
    7·1 answer
  • Mica's creating his web page with a software that is free of charge for the first month. If he likes the program, he will have t
    8·2 answers
  • A computer scientist from the 1960's who developed the mouse, computer networking, and used a small musical keyboard to control
    6·1 answer
  • A client-server relationship is the basic form of a ____?
    15·1 answer
  • Which role is delegated to personnel of the IT department and is responsible for maintaining the integrity and security of the d
    10·1 answer
  • What is a defult? pls help if you wouldn't mind
    11·2 answers
  • Which option on the Format tab is used to modify particular portions of the chart?
    13·1 answer
  • How to install an older version of prettier on yarn
    9·1 answer
  • Which action does not happen in each iteration of the repeat loop in the
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!