Objective
Create a Python program that replaces each number with a label depending on whether it is even or odd, using a comprehension with if/else.
Instructions
- Read a line with integers separated by spaces.
- With a comprehension with
if/else, generate"E"for even numbers and"O"for odd ones. - Show the labels on a single line, separated by a space.
1 2 3 4
O E O E
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise