分别计算列表中奇数和偶数的和?
键盘输入自行编写
import random
L = [ random.randint(1, 100) for x in range(10) ]
A = [ x for x in L if not x % 2 ]
B = [ x for x in L if x % 2 ]
print(L)
print("偶数列表:{0} 和为:{1}".format(A,sum(A)))
print("奇数列表:{0} 和为:{1}".format(B,sum(B)))