Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-148

Battery Round-Trip Efficiency

Problem

Compute battery round-trip efficiency as the geometric mean of charge and discharge efficiencies: sqrt(charge_eff * discharge_eff).

Both efficiencies are fractions between 0 and 1.

Hint

The geometric mean is the efficiency of a full charge-discharge cycle.

Test cases

case 1
in: [0.9,0.9]
expected: 0.9
case 2
in: [0.81,1]
expected: 0.9
case 3
in: [0.8,0.9]
expected: 0.8485281374238571
case 4
in: [0,0.5]
expected: 0
Starter codePython
def battery_round_trip_efficiency(charge_eff, discharge_eff):
    # Your code here
    pass

4 test cases · run your code against them in the editor