Sum of digits

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))])

Sample session

Problem information

Author: InfBesos

Generation: 2026-01-25T16:41:35.405Z

© Jutge.org, 2006–2026.
https://jutge.org
