blob: ddad129ff82f4014b9620d27303a038e930eca9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
def even_ele(test_tuple, even_fnc):
res = tuple()
for ele in test_tuple:
if isinstance(ele, tuple):
res += (even_ele(ele, even_fnc), )
elif even_fnc(ele):
res += (ele, )
return res
def extract_even(test_tuple):
res = even_ele(test_tuple, lambda x: x % 2 == 0)
return (res)
|