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]
3 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]3 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
When asked about favorite Thanksgiving leftovers, 9% of the people said turkey and 7100 said mashed potatoes. Which food is more
irakobra [83]

Answer:

how many people were asked though

Explanation:

8 0
2 years ago
Direction: List down or enumerate the type of outlets you want to install on your dream house. Also indicate the quantity (in pi
Lorico [155]

Answer:

Apartment outlet 4pcs

Explanation:

6 0
3 years ago
Phil wants to make a dark themed superhero movie. What could be his target demographic?
grin007 [14]

Answer:

D.

male, aged 18-25

5 0
3 years ago
Read 2 more answers
Ai r is compressed by a 30-kW compressor from P1 to P2. The air t emperature i s maintained constant at 25oC during thi s proces
RUDIKE [14]

Answer:

The rate of entropy change of the air is -0.10067kW/K

Explanation:

We'll assume the following

1. It is a steady-flow process;

2. The changes in the kinetic energy and the potential energy are negligible;

3. Lastly, the air is an ideal gas

Energy balance will be required to calculate heat loss;

mh1 + W = mh2 + Q where W = Q.

Also note that the rate of entropy change of the air is calculated by calculating the rate of heat transfer and temperature of the air, as follows;

Rate of Entropy Change = -Q/T

Where Q = 30Kw

T = Temperature of air = 25°C = 298K

Rate = -30/298

Rate = -0.100671140939597 KW/K

Rate = -0.10067kW/K

Hence, the rate of entropy change of the air is -0.10067kW/K

3 0
3 years ago
Which of the following explains the difference between conservation and preservation?
Natalija [7]

Answer:

b

Explanation:

8 0
2 years ago
Other questions:
  • 4.
    6·2 answers
  • A 3.5-m3 rigid tank initially contains air whose density is 2 kg/m3 . The tank is connected to a high-pressure supply line throu
    8·1 answer
  • Which career related to architecture deals with the planning of entire cities and focuses on designing and arranging buildings,
    9·2 answers
  • A vehicle is moving at a velocity, v, given by v =12t - 3t2 ms-1. Use
    7·1 answer
  • A water jet strikes normal to a fixed plate. If diameter of the outlet of the nozzle is 8 cm,and velocity of water at the outlet
    11·1 answer
  • When will the entropy value of the universe attained its maximum value?
    13·1 answer
  • You’re going to write a program that models the Littleton City Lotto (not a real Lotto game). The program is going to allow to u
    6·1 answer
  • Can somebody help me with that
    13·1 answer
  • Chọn dữ liệu phù hợp và biểu diễn chúng dưới dạng biểu đồ, từ đó cho biết 3 yếu tố
    7·1 answer
  • According to Gary Sirota, the proposed Bajagua wastewater treatment plant is a beneficial solution because __________.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!