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
kenny6666 [7]
3 years ago
14

Write a program that will take a file named Celsius.dat that contains a list of temperatures in Celsius (one per line), and will

create a file Fahrenheit.dat that contains the same temperatures (one per line, in the same order) in Fahrenheit. Note: You may create Celsius.dat using a word processor or any other text editor rather than writing Python code to create the file. It simply needs to be a text file.
Computers and Technology
1 answer:
dedylja [7]3 years ago
5 0

Answer:

celciusFile=open("celcius.dat","r")

fahrenheitFile=open("fahrenheit.dat","w")

# Iterate over each line in the file

for line in celciusFile.readlines():

# Calculate the  fahrenheit

   fahrenheit = 9.0 / 5.0 * float(line) + 32

#write the  Fahrenheit values to the  Fahrenheit file

   fahrenheitFile.write("%.1f\n" % fahrenheit)

# Release used resources

celciusFile.close()

fahrenheitFile.close()

Explanation:

<em></em>

<em>celciusFile=open("celcius.dat","r") </em>

<em>fahrenheitFile=open("fahrenheit.dat","w") </em>

open the Celsius file in the read mode and assign it to a variable.

open the  Fahrenheit file in the write mode and assign it to a variable.

read mode means you can only use/read the content in the file but cannot alter it.

write mode means you can write new data to the file.

<em> </em>

<em />

  • <em># Iterate over each line in the file </em>

<em>for line in celciusFile.readlines(): </em>

The values contained in the Celsius file are collected.

  • <em># Calculate the  fahrenheit </em>

<em>    fahrenheit = 9.0 / 5.0 * float(line) + 32 </em>

The values are then converted to Fahrenheit.

  • <em>#write the  Fahrenheit values to the  Fahrenheit file</em>

<em>    fahrenheitFile.write("%.1f\n" % fahrenheit) </em>

The Fahrenheit values are written to the  Fahrenheit file

<em>%.1f</em><em>  is used to specify the number of digits after decimal. and </em><em>\n </em><em>adds a new line.</em>

<em />

  • <em># Release used resources </em>

<em>celciusFile.close() </em>

<em>fahrenheitFile.close() </em>

All files are closed

<em />

You might be interested in
Analytical processing uses multi-levelaggregates, instead of record level access.? True? False
Dominik [7]

Answer:

True.

Explanation:

Analytical processing uses multi-levelaggregates, instead of record level access.

8 0
3 years ago
Please select all examples of systems using guided media. Group of answer choices ADSL 802.11 Wifi Home Networks Global Position
dusya [7]

Answer:

- ADSL.

- Ethernet Home Networks.

- Fiber Optics.

- Cable Television.

Explanation:

In Computer, Guided media also known as bounded media involves the use of cable such as fibre-optic cables, coaxial cable to transmit data signals from one system device to another.

Examples of systems using guided media are;

- ADSL.

- Ethernet Home Networks.

- Fiber Optics.

- Cable Television.

7 0
3 years ago
What is output? c = 1 sum = 0 while (c &lt; 10): c = c + 3 sum = sum + c print (sum)
Valentin [98]

Answer:

21

Explanation:

The values of c that make it into the loop are 1, 4, 7.

The values that are added to sum are 3 higher, i.e., 4,7 and 10.

The sum of those is 21.

p.s. why did you not run the program yourself?

3 0
3 years ago
A web designer must effectively communicate when he/she designs a web page. If there is too much information to put onto one pag
valina [46]
Usually they'll add a link to the bottom of the page to the next page.

7 0
3 years ago
What is a computer that provides services and connections to other computers on a network is called a ________ ?
melisa1 [442]
They are called servers .. you can also call them hosts
6 0
3 years ago
Other questions:
  • The countryside presents
    11·1 answer
  • How many mustangs are built every day
    13·2 answers
  • Consider an application that transmits data at a steady rate (for example, the sender generates an N-bit unit of data every k ti
    8·1 answer
  • A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e.,the
    15·1 answer
  • The most widely used presentation software program is Microsoft PowerPoint. You can produce a professional and memorable present
    8·1 answer
  • Please answer immediately!!!
    6·1 answer
  • Write a program to display the roll number of students who have scored 100 in math. display appropriate message if none have sco
    5·1 answer
  • Write code using the range function to add up the series 99, 98, 97,...
    11·1 answer
  • PLEASE HELP! :)
    14·1 answer
  • A transistor may be used as an amplifier in an electronic circuit. <br> Select one: True False
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!