All problems
Capacity Factor
Problem
Compute the capacity factor of a power series: mean(power) / capacity.
Return 0.0 for an empty series or non-positive capacity.
Hint
It is the average output divided by the nameplate rating.
Test cases
case 1
in: [[5,10,0,5],10]
expected: 0.5
case 2
in: [[10,10],10]
expected: 1
case 3
in: [[1,2,3],0]
expected: 0
case 4
in: [[],10]
expected: 0
Starter codePython
def capacity_factor(power, capacity):
# Your code here
pass4 test cases · run your code against them in the editor