Ask Question
6 April, 23:46

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

+1
Answers (1)
  1. 7 April, 01:41
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers