All problems
Average Value Point for a Line
Problem
For a linear function f(x) = c0 + c1 * x on [a, b], the average value is attained at the midpoint of the interval.
Given c0, c1, a, and b, return the point c where f(c) equals the average value.
Hint
A line is symmetric about its midpoint.
Test cases
case 1
in: [1,2,0,4]
expected: 2
case 2
in: [0,5,-3,7]
expected: 2
case 3
in: [10,-1,2,6]
expected: 4
Starter codePython
def average_value_point_linear(c0, c1, a, b):
# Your code here
pass3 test cases · run your code against them in the editor