Dessign the function sum_dig(f, k, n) that, given a list f of non negative integers, a non negative integer k and an integer n, returns a list with the first k numbers in f whose digits add up more than n. If f does not have k numbers holding this property, the function will return the empty list.
It’s mandatory to use the function sumadigitos(num) below to calculate the sum of digits:
def sumadigitos(num): return sum([int(i) for i in list(str(num))])
>>> sum_dig([10, 50, 56, 71, 999, 42, 83, 93, 27, 83, 27], 2, 15) [] >>> sum_dig([44, 401, 43, 0, 1, 0, 68, 22, 58, 88], 5, -3) [44, 401, 43, 0, 1] >>> sum_dig([3, 0, 3, 1, 2, 5], 3, 2) [3, 3, 5] >>> sum_dig([3, 4, 5], 3, 3) [] >>> sum_dig([10, 2, 73, 66, 140, 960, 54, 83, 97, 14, 53], 4, 6) [73, 66, 960, 54] >>> sum_dig([1,2,3], 0, 1) []