- 1. 入力、印刷、数字
- 2. 整数と浮動小数点数
- 3. 条件:if-then-else
- 4. 範囲のあるループの場合
- 5. 文字列
- 6. whileループ
- 7. リスト
- 8. 関数と再帰
- 9. 2次元リスト(配列)
- 10. セット
- 11. 辞書
- 12. JavaScript
- 13. HTML5 and CSS
- 14. Responsive Design with Bootstrap
- 15. jQuery
Ad place
Even elements
Statement
Given a list of numbers, find and print all elements that are an even number. In this case use a for-loop that iterates over the list, and not over its indices! That is, don't userange()
In all the problems input the data using input()
and print the result using print()
.
12# Read an integer:# a = int(input())XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Input:
11 2 2 3 3 3 4XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Output:
1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Saved solutions
Tests
Input | Correct answer | |
---|---|---|
1 2 2 3 3 3 4 | 2 2 4 | |
1 2 3 4 5 | 2 4 | |
2 4 6 8 | 2 4 6 8 | |
1 1 1 1 1 1 2 | 2 | |
44 -51 32 -60 -7 -67 62 91 26 -14 | 44 32 -60 62 26 -14 | |
32 -95 -78 -15 -71 -73 -83 53 -91 -82 -71 -52 -60 -18 12 8 98 -92 -83 7 | 32 -78 -82 -52 -60 -18 12 8 98 -92 | |
39 55 -88 56 -39 -92 -30 54 15 94 27 -87 -85 -53 -44 -87 33 38 -22 56 | -88 56 -92 -30 54 94 -44 38 -22 56 |