I am taking an input temp
from user in method parameter
and I want to compare this temp
with another variable oven_temp
in the make_item
method. But I get a NameError
, saying that name temp
is not defined.
I read some posts here and I understood that I need to return
the value from the method - so I did that; but now what? Specifically, I tried:
class maker:
def parameter(self):
temp = int(input('At what temperature do you want to make \n'))
return temp
def make_item(self):
def oven (self):
oven_temp = 0
while (oven_temp is not temp):
oven_temp += 1
print ("waiting for right oven temp")
oven(self)
person = maker()
person.parameter()
person.make_item()
but I still get the NameError
. How do I fix it?