I have this code:
input_numbers = [int(x) for x in input().split(' ')]
input_range = [int(x) for x in input().split(' ')]
for number in input_numbers:
if input_range[0] <= number <= input_range[1]:
print('{}'.format(number), end = ' ')
It should read in two lists of numbers, (where the second list has two values representing a range), and then print numbers from the first list that are between the two numbers in the second list. I want to print all these values with commas after each (including after the last one).
For example, if I input 25 51 0 200 33
and then 0 50
, the output should be 25,0,33,
.
However, I currently get 25 0 33
instead. How can I fix it so that the commas are printed?