Question: For this exercise, you will write a function that takes a list of floats and returns a new list containing only the numbers from that
For this exercise, you will write a function that takes a list of floats and returns a new list containing only the numbers from that list that are within a designated interval. The file must be named interval.py and it must contain a single function named ininterval with four parameters:
The first is a list of floats.
The second is the lower bound of the interval.
The third is the upper bound of the interval.
The fourth is a Boolean indicating whether this is a closed interval. This parameter should have a default value of True indicating that the interval is closed.
The numbers in the returned list must be in the same order as they appeared in the original list. You may assume that the provided lower and upper values represent a valid interval.
Here are some examples illustrating the expected behavior:
ininterval # Default is closed
ininterval False
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
