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
LenKa [72]
4 years ago
13

Write a script named dif.py. This script should prompt the user for the names of two text files and compare the contents of the

two files to see if they are the same. If they are, the script should simply output "Yes". If they are not, the script should output "No", followed by the first lines of each file that differ from each other. The input loop should read and compare lines from each file. The loop should break as soon as a pair of different lines is found. Below are examples of the program input and output along with relevant files:
Engineering
1 answer:
Ainat [17]4 years ago
7 0

Answer:

1

Created on Nov 3, 2018 @author: ASLand

7import atexit

#Read, nanes of both files

Rrintll"Enter tvo files to be compared below

userliamel input ("Enter the nome of the first file: ")

userliame2 input("Enter the name of the second file: ")

ROpen each file

f1 - open(userNamel, r')

@17 f2 = opan(useriame 2, )

tread all the lines into a list

d1 f1.readlines ()

d2 f2.readlines()

re equivalent, print "Yes" else pri

oiterate, and conpare

#11

the

y

if dl == d2:

print("Yes")

atexit

elif for i in range(@, min(len (d1), len(d2))):

if di[i]!=d2[i]:

PCint("No")

print(d1[i])

pcint(d2[])

You might be interested in
Polymers can be natural or synthetic. a)-True b)- false?
Olenka [21]

Answer:

TRUE

Explanation:

Polymers can be natural as well as synthetic

The polymer which are found in nature are called natural polymer tease polymer are not synthesized, they are found in nature

Example of natural polymers is cellulose, proteins etc

On the other hand synthetic polymers are not found in nature they are synthesized in market

There are many example of synthetic polymer

Example : nylon, Teflon etc  

So it is a true statement

8 0
4 years ago
The magic square is an arrangement of numbers in a square grid in such a way that the sum of the numbers in each row, and in eac
Yuki888 [10]

Answer:

See the explanation for the answer;

Explanation:

Matlab code is as given below

-------------------------------------------------------------------------------------Start of code

% Program to create a magic square and verify it

clc

M= magic(5)

% To find sum of elements of each row

r1= sum(M(1,:))      % Sum of row 1

r2= sum(M(2,:))      % Sum of row 2

r3= sum(M(3,:))      % Sum of row 3

r4= sum(M(4,:))      % Sum of row 4

r5= sum(M(5,:))      % Sum of row 5

% To find sum of each coloumn

c1= sum(M(:,1))      % Sum of coloumn 1

c2= sum(M(:,2))      % Sum of coloumn 2

c2= sum(M(:,3))      % Sum of coloumn 3

c2= sum(M(:,4))      % Sum of coloumn 4

c2= sum(M(:,5))      % Sum of coloumn 5

% To find sum of diagonal

d1= sum(diag(M))               % Sum of principal diagonal elements

d2= sum(diag(fliplr(M)))      

-------------------------------------------------------------------------------End of code

Following results are obtained when executed.

M =

   17    24     1     8    15

   23     5     7    14    16

    4     6    13    20    22

   10    12    19    21     3

   11    18    25     2     9

r1 =

   65

r2 =

   65

r3 =

   65

r4 =

   65

r5 =

   65

c1 =

   65

c2 =

   65

c2 =

   65

c2 =

   65

c2 =

   65

d1 =

   65

d2 =

   65

3 0
3 years ago
Ronny has a hydraulic jack. The input force is 250 N, while the output force is 7,500 N. If the area of the pipe below the input
Ganezh [65]

Answer:

6 m²

Explanation:

application of fluid pressure according to  Pascal's principle for the two pistons is given as:

P_1=P_2

Where P₁ is the pressure at the input and P₂ is the pressure at the output.

But P₁ = F₁ / A₁ and P₂ = F₂ / A₂

Where F₁ and F₂ are the forces applied at the input and output respectively and A₁ and A₂ are the area of  the input pipe and output pipe respectively

Since, P_1=P_2

\frac{F_1}{A_1} =\frac{F_2}{A_2}\\

But A₁ = 0.2 m², F₁ = 250 N, F₂ = 7500 N. Substituting values to get:

\frac{F_1}{A_1} =\frac{F_2}{A_2}\\\frac{250}{0.2}=\frac{7500}{A_2}\\  A_2=\frac{7500*0.2}{250} = 6m^2

Therefore, the area of the pipe below the load is 6 m²

6 0
3 years ago
2. The metal to be welded is called the
Sveta_85 [38]

Answer:

I believe the answer is "filler metal"

5 0
3 years ago
You read a research study that concludes that the higher a student's self-esteem, the better he performs in school. This sort of
LiRa [457]

Answer:

Negative correlation

7 0
4 years ago
Other questions:
  • Tadpoles raised in water with atrazine levels of 0.1 ppb should produce a higher percentage of male frogs with gonadal abnormali
    13·1 answer
  • A 4 standard type L copper tube conveys propyl alcohol at 151/s. The pipe is laid out horizontally. It is 60 îm long. Calculáte
    6·1 answer
  • Determine the COP of a refrigerator that removes heat from the food compartment at a rate of 5160 kJ/h for each kW of power it c
    14·2 answers
  • The atomic radii of a divalent cation and a monovalent anion are 0.77 nm and 0.136 nm, respectively.1- Calculate the force of at
    11·1 answer
  • Two different fuels are being considered for a 2.5 MW (net output) heat engine which can operate between the highest temperature
    15·1 answer
  • The moons light-colored highlights are
    7·1 answer
  • A two-bus power system is interconnected by one transmission line. Bus 1 is a generator bus with specified terminal voltage magn
    6·1 answer
  • 0/5 pts
    9·1 answer
  • The oxygen consumption of an activated sludge plant is 60 g O2/L.d for the degradation of
    11·1 answer
  • Simplify the expression below:<br><br> 313 + 12 =
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!