Dec-31-2018, 07:23 PM
Hello,
As a newbie I wrote the following code.
My understanding is that this will create a file called temps.txt and this file will have 4 temperatures in it.
The code executes without any error messages.
However the file is not being created in the directory.
I am using python 3.7 in the Eclips IDE on windows 7.
I would really appreciate if someone can point out to me where I am going wrong.
As a newbie I wrote the following code.
1 2 3 4 5 6 7 8 |
temperatures = [ 10 , - 20 , - 289 , 100 ] def temp_convert(temperatures): with open ( "temps.txt" , 'w' ) as myfile: for c in temperatures: if c > - 273.15 : f = c * 9 / 5 + 32 myfile.write( str (f) + "\n" ) |
The code executes without any error messages.
However the file is not being created in the directory.
I am using python 3.7 in the Eclips IDE on windows 7.
I would really appreciate if someone can point out to me where I am going wrong.