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
When saving a document or drawing, you determine the destination folder in which the file will be saved by?
bekas [8.4K]

making a selection in the Save in: box.<span>

</span>
8 0
2 years ago
PLS HELP!!
Vera_Pavlovna [14]

Answer:

A. f/2.8

Explanation:

A hole within a lens, through which light travels into the camera body is referred to as the APERTURE.

It is typically expressed as "f number" in photography. Basically, a fast lens is any lens with a maximum aperture of f/4 or more i.e f/2.8 , f/1.8 , f/1.4 etc.

The smaller the number is the bigger the maximum aperture is. Hence, the bigger the maximum aperture the more light that your lens will allow in.

Therefore, the ideal aperture settings for a fast lens is f/2.8

7 0
3 years ago
What does this loop that uses a range function do? for i in range(7, 15): print("goodbye") It prints "goodbye" 8 times, numbered
goldfiish [28.3K]

Answer:

It prints "goodbye" 8 times.

Explanation:

The loop being described in this scenario would print "goodbye" 8 times. It would not include numbers detailing the range since the loop instructions only state for the system to print("goodbye") and nothing else. Also, it would only print it 8 times because in a range the endpoint is not included, this is mainly because in programming data structures tend to run on 0-based indexing.

6 0
2 years ago
Read 2 more answers
Which of the following is not a use of a hash function
soldi70 [24.7K]

Answer:

the answer would be there

Explanation:

7 0
3 years ago
if a person walks 10 metres due to south in 10 seconds 10 due east in the next 10 seconds and transmitted you're not in the next
Scorpion4ik [409]

Answer:

\frac{1}{3}\ m/s

Explanation:

The computation of the velocity by using the following formula is

As we know that

Velocity = \frac{Displacement}{Total\ time\ taken}

where,

Displacement is 10 meters

Total time taken is 30 seconds

Now placing these values to the above formula

So, the velocity of Dash is

= \frac{10\ meters}{30\ seconds}

= \frac{1}{3}\ m/s

We simply applied the above formula so that we can get the velocity and the same is to be considered

5 0
3 years ago
Other questions:
  • PLS HELP ASAP! WILL GIVE BRAINLIEST!
    14·1 answer
  • You took a fantastic photograph that you want to use in the report you're writing using DTP software. To import the photo into y
    6·2 answers
  • Write a program that checks for car mileage. if the mileage is greater than 100000, display "clunker!". if not, display "buy it!
    7·1 answer
  • ________ is the abbreviation for the place in the computer where the programs and data the computer is currently using are store
    8·1 answer
  • Which of the following are the rows or columns of white space created between grids?
    7·1 answer
  • How assemblers and linkers work together?
    13·1 answer
  • What are some (free) good animation websites (for PC/Microsoft) for a short informational video about homelessness?
    15·1 answer
  • Write a loop to output the word EXAM 99 times
    8·1 answer
  • Four differences between fourth and fifth generation of computers​
    12·1 answer
  • How do i use a computer (i'm 99999 years old)
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!