12.給你一個正整數(shù)列表 L, 如 L=[2,8,3,50], 判斷列表內(nèi)所有數(shù)字乘積的最后一個非零數(shù)字的奇偶性,奇數(shù)輸出1,偶數(shù)輸出0. 如樣例輸出應(yīng)為0.
L = [2,8,3,50]
a, b = 0, 0
for i in L:
while i % 2 == 0:
a += 1
i = i/2
while i % 5 == 0:
b += 1
i = i/5
if a > b:
print 0
else:
print 1