Question: ( Python problem ) 9 . 4 . 2 : Class and instance object types. 9 . 4 . 2 : Class and instance object

(Python problem)9.4.2: Class and instance object types.
9.4.2: Class and instance object types.
538018.3244522.qx3zqy7
Jump to level 1
In the set_voltage() method of the VoltageRegulator class object, if device_voltage is greater than the class attribute
minimal_voltage, then assign instance attribute measured_voltage with device_voltage.
Click here for example
class VoltageRegulator:
minimal_voltage =65
def (self):
self.measured_voltage = self.minimal_voltage
def set_voltage(self, device_voltage):
|'' Your code goes here
voltage_regulator_data1= VoltageRegulator()
voltage_regulator_data1.set_voltage(int(input()))
print(f'Regulated voltage at time 1: {voltage_regulator_data1.measured_voltage}')
voltage_regulator_data2= VoltageRegulator()
In the set_voltage() method of the VoltageRegulator class object, if device_voltage is greater than the class attribute minimal_voltage, then assign instance attribute measured_voltage with device_voltage.
Click here for example
Ex: If the input is:
25
82
then the output is:
Regulated voltage at time 1: 65
Regulated voltage at time 2: 82
 (Python problem)9.4.2: Class and instance object types. 9.4.2: Class and instance

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!