Answer:
The program is as follows:
def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold):
for i in user_values:
if i <= upper_threshold:
print(i,end=" ")
def get_user_values():
user_values = []
n = int(input())
for i in range(n):
num = int(input())
user_values.append(num)
upper_threshold = int(input())
output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold)
get_user_values()
Step-by-step explanation:
This defines the output_ints_less_than_or_equal_to_threshold method
def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold):
This iterates through user_values
for i in user_values:
For every item in user_values
if i <= upper_threshold:
This prints all items less than or equal to the upper threshold
print(i,end=" ")
This defines get_user_values method
def get_user_values():
This creates an empty list
user_values = []
This gets the number of inputs
n = int(input())
This iterates through n
for i in range(n):
This gets input for every item of the list
num = int(input())
This appends the input to the list
user_values.append(num)
This gets input for upper threshold
upper_threshold = int(input())
This calls output_ints_less_than_or_equal_to_threshold method
output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold)
The main begins here; This calls get_user_values method
get_user_values()