python打印奇数
Given a list, and we have to print the list after removing the ODD numbers in Python.
给定一个列表,我们必须在Python中删除ODD数字后打印该列表。
Example:
例:
Input:
list = [11, 22, 33, 44, 55]
Output:
list after removing ODD numbers
list = [22, 44]
Logic:
逻辑:
Traverse each number in the list by using for...in loop.
使用for ... in循环遍历列表中的每个数字。
Check the condition i.e. checks number is divisible by 2 or not – to check ODD, number must not be divisible by 2.
检查条件,即检查数字是否可以被2整除–要检查ODD,数字不