📜  python 3个范围的数字是偶数 - Python代码示例

📅  最后修改于: 2022-03-11 14:46:59.496000             🧑  作者: Mango

代码示例2
def check(element):
    return all(ord(i)%2 == 0 for i in element)  # all returns True if all digits i is even in element

lst = [str(i) for i in range(1000,3001)]        # creates list of all given numbers with string data type
lst = list(filter(check,lst))                   # filter removes element from list if check condition fails
print(",".join(lst))