Question: ( Python problem ) 9 . 4 . 2 : Class and instance object types. 9 . 4 . 2 : Class and instance object
Python problem: Class and instance object types.
: Class and instance object types.
Jump to level
In the setvoltage method of the VoltageRegulator class object, if devicevoltage is greater than the class attribute
minimalvoltage, then assign instance attribute measuredvoltage with devicevoltage.
Click here for example
class VoltageRegulator:
minimalvoltage
def self:
self.measuredvoltage self.minimalvoltage
def setvoltageself devicevoltage:
Your code goes here
voltageregulatordata VoltageRegulator
voltageregulatordatasetvoltageintinput
printfRegulated voltage at time : voltageregulatordatameasuredvoltage
voltageregulatordata VoltageRegulator
In the setvoltage method of the VoltageRegulator class object, if devicevoltage is greater than the class attribute minimalvoltage, then assign instance attribute measuredvoltage with devicevoltage.
Click here for example
Ex: If the input is:
then the output is:
Regulated voltage at time :
Regulated voltage at time :
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
