Page 1 of 1

Please use python with executed tests

Posted: Mon Jun 06, 2022 5:16 pm
by answerhappygod
Please use python with executed tests
Please Use Python With Executed Tests 1
Please Use Python With Executed Tests 1 (83.22 KiB) Viewed 24 times
2. Transforming. Exercise Write a function transform_in_interval (vals: List[float], f: Callable, lo: float, hi: float) -> List[float]. It finds all the numbers in vals that are at least 10, and no more than hi, and transforms each such number using f. For example, def add1(x: float) -> float: return x + 1 check.expect ("add1 in [1,4]", transform_in_interval([2,4,6,0,1], add1, 1, 4), [3, 5, 2]) def square (x: float) -> float: return x**2 check.expect("square in [5,10]", transform_in_interval([2,4,6,0,1], square, 5, 10), [36])