Loops and patterns · Python exercise
Read a line of integers and add only the even ones.
Read one line of space-separated integers and print the sum of those that are even. If there are no even values, print 0.
Example 1
Input
1 2 3 4 5 6
Output
12
Example 2
Input
1 3 5
Output
0
How testing works
Your code runs once per test case with that case's standard input. Output is compared after normalising trailing spaces and blank lines at the end. Use input() without a prompt when the exercise expects clean output.
Loading editor…
Press Run tests to execute your code against every input case. Python runs in a Web Worker in your browser.