Answer:
The program in Python is as follows:
mylist = []
num = int(input("Length: "))
for i in range(num):
inp = int(input(": "))
mylist.append(inp)
lower = int(input("Lower Bound: "))
upper = int(input("Upper Bound: "))
for i in mylist:
if i >= lower and i <= upper:
print(i, end=" ")
Step-by-step explanation:
This initializes an empty list
mylist = []
The prompts the user for length of the list
num = int(input("Length: "))
The following iteration reads input into the list
for i in range(num):
inp = int(input(": "))
mylist.append(inp)
This gets the lower bound of the range
lower = int(input("Lower Bound: "))
This gets the upper bound
upper = int(input("Upper Bound: "))
This iterates through the list
for i in mylist:
This checks for elements of the list within the range
if i >= lower and i <= upper:
This prints the list element
print(i, end=" ")