Ask Question
27 July, 19:20

python 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

+2
Answers (1)
  1. 27 July, 22:37
    0
    with open ('celcius. dat', 'r') as fIn, open ('fahrenheit. dat', 'w') as fOut:

    for line in fIn:

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

    fOut. write ("%.1f/n" % fahrenheit)

    You can control the number of decimals in the formatting clause in the write statement.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “python Write a program that will take a file named Celsius. dat that contains a list of temperatures in Celsius (one per line), and will ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers