***PYTHON*** MyProgamming Lab
Suppose there is a class AirConditioner. The class supports the following behaviors: turning the air conditioner on, off, and setting the desired temperature. The following methods are provided for these behaviors: turn_on and turn_off, which accept no arguments and return no value, and set_temp, which accepts an int argument and returns no value.
There is a reference variable my_ac to an object of this class, which has already been created. Invoke a method telling the object to set the air conditioner to 72 degrees.
class AirConditioner:
def turn_on(self):
self.conditioner="on"
def turn_off(self):
self.conditioner="off"
def set_temp(self,temp):
self.airtemp=temp
if __name__=="__main__":
my_ac=AirConditioner()
my_ac.set_temp(72)
print(my_ac.airtemp)
Get Answers For Free
Most questions answered within 1 hours.