Skip to content
Advertisement

How can I define name ‘unit’ in def to?

I am trying to create a temperature conversion module. My class is set up as below:

JavaScript

I then try to convert using the following:

JavaScript

The original prints work but the conversion has the error: NameError: name ‘unit’ is not defined. How can I avoid this?

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement