n = [14, 2, 234, 56, 44, 231, 9, 0]
answer = []
su = 0
for el in n:
if el < 10 and el != 0:
if el % 2 == 0:
answer.append(el)
else:
for char in str(el):
su += int(char)
if su > 0 and su % 2 == 0:
print(answer)
Объяснение:
n = [14, 2, 234, 56, 44, 231, 9, 0]
answer = []
su = 0
for el in n:
if el < 10 and el != 0:
if el % 2 == 0:
answer.append(el)
else:
for char in str(el):
su += int(char)
if su > 0 and su % 2 == 0:
answer.append(el)
su = 0
print(answer)
Объяснение: