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
Which of the following is not a relationship set between elements in a sketch​
Svet_ta [14]

Answer:

The entity relationship (ER) data model has existed for over 35 years. It is well suited to data modelling for use with databases because it is fairly abstract and is easy to discuss and explain. ER models are readily translated to relations. ER models, also called an ER schema, are represented by ER diagrams.

6 0
2 years ago
What is a radio wave made up of? Molecules? Electrons? Other?
mafiozo [28]

Radio waves are radiated by charged particles when they are accelerated. They are produced artificially by time-varying electric currents, consisting of electrons flowing back and forth in a specially-shaped metal conductor called an antenna. ... Radio waves are received by another antenna attached to a radio receiver.

4 0
3 years ago
Read 2 more answers
A biotechnology company produced 225 doses of somatropin, including 11 which were defective. Quality control test 15 samples at
Radda [10]

Answer:

  • <u>0.59</u>

Explanation:

The <em>batch</em> is <em>rejected</em> if any of the <em>random samples are found defective</em>, or, what is the same, it will be accepted only if all 15 samples are good.

The probability that none be defective is the same probability that all the samples are good. Thus, start to calculate the probability that the batch is accepted.

The probability that the first sample is good is 214 /225, because there are 225 - 11 = 214 good samples in 225 doses.

The probability that the second samples is good too is 213/224, because there is 1 less good sample, in the 224 remaining samples.

By the same process, you conclude that the consecutive probabilities of selecting a good sample are: 212/223, 211/222, 210/221, . . . up to 199/211.

The joint probability of all the samples are good is the product of each probability:

\frac{214}{225}\cdot\frac{213}{224}\cdot\frac{212}{223}\cdot\frac{211}{222}\cdot\frac{210}{221}\cdot\frac{209}{220}\cdot\frac{208}{219}\cdot\frac{207}{218}\cdot\frac{206}{217}\cdot\frac{205}{216}\cdot\frac{204}{215}\cdot\frac{203}{214}\cdot\frac{202}{213}\cdot\frac{201}{212}\cdot\frac{200}{211}\cdot\frac{199}{210}

The result is: 0.41278 ≈ 0.41

The conclusion is that the probability that all the samples are good and the batch is accepted is 0.41.

Therefore, <em>the probability that the batch is rejected</em> is 1 - 0.41 = 0.59.

4 0
4 years ago
Which is not required when working in a manufacturing facility?
Artyom0805 [142]
Flip flops are not required
5 0
3 years ago
What do we need to do to get CO2 emissions all the way to zero?
Svetlanka [38]

Answer:

A key element is powering economies with clean energy, replacing polluting coal - and gas and oil-fired power stations - with renewable energy sources, such as wind or solar farms. This would dramatically reduce carbon emissions. Plus, renewable energy is now not only cleaner, but often cheaper than fossil fuels

Explanation:

here is your answer if you like my answer please follow

3 0
3 years ago
Other questions:
  • The slope of a moment diagram is the load. a)-True b)-False
    8·1 answer
  • What are supercapacitors ?
    13·2 answers
  • A student is using a 12.9 ft ramp to raise an object 6 ft above the ground.
    5·1 answer
  • A DNS record that's used to redirect traffic from one domain name to another is known as a _______ record.
    11·1 answer
  • Ventajas motor avion
    5·1 answer
  • Water flows with a velocity of 3 m/s in a rectangular channel 3 m wide at a depth of 3 m. What is the change in depth and in wat
    9·1 answer
  • Leland wants to work in a Production career operating heavy machinery. Which type of education or training should Leland seek?
    9·2 answers
  • Why is engineering profession important ​
    11·1 answer
  • All people<br><br><br>id 5603642259 pd 123456<br>on z o o m​
    15·1 answer
  • A ___ is a type of purlin used as a horizontal stiffener between columns around the perimeter of a building.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!