Skip to main content
 首页 » 编程设计

python之偶数的位数应该是偶数

2025年05月04日12Free-Thinker

<分区>

我需要打印特定范围内的所有偶数(例如 2000 到 4000)。但是,条件是,“该数字的所有数字都应为偶数”(例如 2222、2468)。在这种情况下,Zero('0') 无关紧要。

我试过这个:

start = int(input("Enter the start of range: "))  
end = int(input("Enter the end of range: "))  
for num in range(start, end + 1):  
if num % 2 == 0:  
    print(num, end = " ")  

以上代码只打印所有偶数。

希望大家理解。有什么想法吗...?