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 the following is best practice to minimize the chance of infecting your mobile device with malware
lawyer [7]
U Can use an anti virus, or do daily malware scans in ur device
7 0
3 years ago
Eva is the network architect for her company's large cloud deployment; she has interconnected her private cloud to a community c
ivann1987 [24]

Answer:

The appropriate response is "Cloud bursting".

Explanation:

  • A strategy for the implementation of a program in a proprietary cloud or network infrastructure that explodes onto a public cloud if availability or production for computational power increases, could be considered Cloud bursting.
  • It enables extra cloud capabilities throughout cases where additional facilities have been required.
6 0
3 years ago
Sharon wants to import data from an old database into a new database. She notices some of the field names are different. Sharon
DerKrebs [107]

The answer to this question is Sharon will need to map.

4 0
3 years ago
Read 2 more answers
By default, client DHCPv6 messages are sent using _____ scope. (Points : 3) the anycast address
coldgirl [10]

Answer: Router's prefix

Explanation: DHCPv6 (Dynamic host configuration protocol version 6) is the protocol used for an IPv6(Internet protocol version 6) network's host,prefixes,address and other such configurations.The prefix is used for sending the messages of DHCPv6 in the default situation.

In default situation the prefix acts as the cluster of the IP address and thus sends the the message to the destination using the address. Other options are incorrect because anycast address, local link and  FF02::0A does not transmit the message in the default situation.Thus the correct option is router's prefix.

7 0
3 years ago
What is library function? list any three library function​
attashe74 [19]

Answer:

Library Functions: Library functions are the ones which are predefined functions.

Explanation:

Library Functions must be used along with the appropriate header files .

Header files contains the signature of library functions.

Using these functions it reduces the time of the programmer .

List of some library Functions:(in C Language)

  1. printf()
  2. scanf()
  3. sqrt()
  4. strcpy()
  5. strcmp()

7 0
3 years ago
Other questions:
  • Suppose two computers (A &amp; B) are directly connected through Ethernet cable. A is sending data to B, Sketch the waveform pro
    9·1 answer
  • Professional photographers often use the lowest quality settings on their cameras since this can be reversed in Photoshop.
    7·2 answers
  • What is the acronym that helps you remember the order of math operations?
    9·2 answers
  • WHICH COMPUTER COMPONENT CONTAINS ALL THE CIRCUITRY NECESSARY FOR THE OTHER COMPONENTS OR DEVICES TO COMMUNICATE WITH ONE ANOTHE
    12·1 answer
  • A finally clause will execute:
    8·1 answer
  • Emily loves her job as an executive recruiter for a large hospital located in Seattle, Washington. Part of Emily's job requires
    11·1 answer
  • Describe how a computer checks whether the image just taken by the camera matches the scanned photograph.
    12·1 answer
  • Helpppppp me please cuz its due rn. put the correct word in the correct spot
    14·1 answer
  • Which is an example of machine-to-machine communication?
    7·1 answer
  • Enabling encryption of all data on a desktop or laptop computer is generally considered:______.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!