@@ -23,11 +23,11 @@ def electric_power(voltage: float, current: float, power: float) -> tuple:
2323 >>> electric_power(voltage=2, current=4, power=2)
2424 Traceback (most recent call last):
2525 ...
26- ValueError: Only one argument must be 0
26+ ValueError: Exactly one argument must be 0
2727 >>> electric_power(voltage=0, current=0, power=2)
2828 Traceback (most recent call last):
2929 ...
30- ValueError: Only one argument must be 0
30+ ValueError: Exactly one argument must be 0
3131 >>> electric_power(voltage=0, current=2, power=-4)
3232 Traceback (most recent call last):
3333 ...
@@ -38,7 +38,7 @@ def electric_power(voltage: float, current: float, power: float) -> tuple:
3838 Result(name='current', value=3.0)
3939 """
4040 if (voltage , current , power ).count (0 ) != 1 :
41- raise ValueError ("Only one argument must be 0" )
41+ raise ValueError ("Exactly one argument must be 0" )
4242 elif power < 0 :
4343 raise ValueError (
4444 "Power cannot be negative in any electrical/electronics system"
@@ -49,8 +49,6 @@ def electric_power(voltage: float, current: float, power: float) -> tuple:
4949 return Result ("current" , power / voltage )
5050 elif power == 0 :
5151 return Result ("power" , float (round (abs (voltage * current ), 2 )))
52- else :
53- raise ValueError ("Exactly one argument must be 0" )
5452
5553
5654if __name__ == "__main__" :
0 commit comments