When I copy a text from the epub Pract progr. like def to_celsius(t): return (t - 32.0) * 5.0 / 9.0 def above_freezing(t): return t > 0 into Wing IDE nothing does as I expect. wrong asci, to_celcius does not exist etc. what is wrong??
import temperature temperature.above_freezing(temperature.to_celsius(33.3)) Traceback (most recent call last): File “", line 1, in AttributeError: 'module' object has no attribute 'to_celsius'
I do not know whaT this is.
It looks like a font problem between epub and Wing. I copied and pasted your code and it had syntax errors for me. I also tried copying and pasting from the PDF version, and that one actually worked. Here’s what I have in temperature.py:
def to_celsius(t): return (t - 32.) * 5 / 9 def above_freezing(t): return t > 0
And here is my shell interaction:
>>> import temperature >>> temperature.above_freezing(temperature.to_celsius(33.3)) True
My guess for what caused your problem is that, because there was a syntax error in your temperature.py file, the functions weren’t getting properly define.