I didn't get the output in the .txt file

  • Thread starter Justwant Ningthoujam
  • Start date
J

Justwant Ningthoujam

Guest
I run the following program and expect to get the output in a .txt file.

I have run this in spyder IDE with python 3.6.

temperatures = [10,-20,-289,100]

file = open('temperature.txt','w')

def f_to_c(temperatures):
for celsius in temperatures:
if celsius > -273.15:
fahrenheit = celsius * (9/5) + 32
file.write(str(fahrenheit))

f_to_c(temperatures)


There is no error message in this code, but I didn't get the output in the .txt file. Can you help?

Continue reading...
 
Top