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
Lisa has had her California real estate license suspended for violations involving mobile homes under the California Business an
yan [13]

Answer:

Both A and B.

Explanation:

In the above statement, there some details of the question is missing that is options.

She has already had its California property license revoked under California Corporation and Occupations Law for breaches regarding mobile homes. So, she possibly she sent a check for mobile home payments to the State of California as well as the check was not honoured and she has participated knowingly in the sale of a mobile home.

7 0
3 years ago
What is the relationship between CAD and CIM ?
Marat540 [252]
<span> CAM( computerised Aided Manufacture) is when you have workers being helped by computerised tools, CIM (computerised intergated manufacture) is when the whole process is computerised, in manufacture this usually uses robotic arms. These can manufacture 24/7 in needed, they can work very accurately ( they are faster and stronger than a human arm) </span>
5 0
3 years ago
Read 2 more answers
With this type of memory, large programs are divided into parts and the parts are stored on a secondary device, usually a hard d
-Dominant- [34]
The answer to this question is the term virtual memory. A virtual memory is a type of memory that uses a secondary memory which is implemented on hardware and software. A virtual memory maps and combines virtual addresses into a physical address inside the computer memory and operating system controls the memory into virtual memory.
8 0
3 years ago
Regression testing should be a normal part of integration testing because as a new module is added to the system new
nikklg [1K]
It's E) both A and B A) Control logic is invoked B) Data flow paths are established
7 0
2 years ago
COMO DEFINES LAS PALABRAS COMPUTADOR Y DISPOSITIVO? MENCIONA EJEMPLOS
Basile [38]

Explanation:

es una máquina digital programable que ejecuta una serie de comandos para procesar los datos de entrada, obteniendo convenientemente información que posteriormente se envía a las unidades de salida. Una computadora está formada físicamente por numerosos circuitos integrados y varios componentes de apoyo, extensión y accesorios, que en conjunto pueden ejecutar tareas diversas con suma rapidez y bajo el control de un programa (software).

3 0
3 years ago
Other questions:
  • Cell phone producers charge a _____, which consumers pay to buy the phones. profit production cost price
    12·1 answer
  • A.<br> Post-It note<br> b.<br> notebook<br> c.<br> tutor<br> d.<br> spell check
    14·1 answer
  • How do you uninstall sc update?
    13·2 answers
  • To run a PHP application that has been deployed on your own computer you can enter a URL in the address bar of your browser that
    7·1 answer
  • Your help will help me understand my answers by comparing to yours. Your kind contribution is very much appreciated.
    6·1 answer
  • 3. Cellular phone technology works on a system of geographically separated zones
    12·1 answer
  • Calculate the resistance of an unknown resistor in a circuit with 30 volts and 6 amps. The formula is R = V/I.
    6·1 answer
  • Damion recently did an update to his computer and added a new video card. After the update, Damion decided that he would like to
    14·1 answer
  • Describe accessibility in Windows 7 ​
    13·1 answer
  • When the user types into a Textbox control, the text is stored in the control's __________ property.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!