python編寫實現求一個整數參數的偶數位之和的名為evensum的函數?
def evensum(a):
sum = 0
m = str(a)[::-1]
n = m[1::2]
for i in n:
sum += int(i)
print('和是'+str(sum))
evensum(123456)
上一篇pyqt可以做什么
python編寫實現求一個整數參數的偶數位之和的名為evensum的函數?
def evensum(a):
sum = 0
m = str(a)[::-1]
n = m[1::2]
for i in n:
sum += int(i)
print('和是'+str(sum))
evensum(123456)