5. Even Out
by CodeChum Admin
Instructions:
Input two integers in one line, separated by a space. The first integer shall represent the starting point, and the other, the ending point.
Print out all even numbers that are within the range of the starting and ending point (inclusive or including the ending point).
Instructions
Create two variables assigned with an input() function that will accept integer values. Note that the integer values will all be typed in one line separated by space, so remember how to do that with the past lessons on taking multiple inputs in one line.
Print out all even numbers that are within the range of the first and second inputted integers. You must also remember that the inputted integers are also included in evaluating if it's an even number so be careful in filling out your range() function for this one.
Input
A line containing two integers separated by a space.
5 10
Output
A line containing integers separated by a space.
6 8 10
mn, mx = map(int, input().split())
if mn % 2:
mn += 1
print(*range(mn, mx + 1, 2))
Comments
Leave a comment