 Spot some numbers

Write a function spot_them that receives a list of integers lst and an
integer k, 0 ≤ k ≤ 9 and returns a list with the positions in lst that
contain a number with the digit k.

    def spot_them(lst, k) :
        '''
        >>> spot_them([23, 455, 0, -12, 51], 5)
        [1, 4]
        >>> spot_them([205, 28, 94, 2], 2)
        [0, 1, 3]
        >>> spot_them([7, 8, 0, 33], 4)
        []
        '''

For instance, if lst=[23,455,0,-12,51] and k=5, the result should be
[1,4] since those are the positions in lst containing numbers with the
digit 5.

Important: Only the function will be evaluated. If you submission
includes a main program, it must be either commented out, or under the
condition     if __name__ == ’__main__’:

Problem information

Author: ProAl professors

Generation: 2026-01-25T17:16:31.245Z

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