Answer:
Step-by-step explanation:
The following code is written in Python and it is a function called filter, which takes in the requested inputs. It then places the threshold in its own variable and pops it out of the array of inputs. Then it loops through the array comparing each element with the threshold and printing out all of the ones that are less than or equal to the threshold.
def filter():
num_of_elements = input("Enter a number: ")
count = 0
arr_of_nums = []
while count <= int(num_of_elements):
arr_of_nums.append(input("Enter a number: "))
count += 1
threshold = arr_of_nums[-1]
arr_of_nums.pop(-1)
print(threshold)
for element in arr_of_nums:
if int(element) < int(threshold):
print(element)
else:
continue