Write a function spot_them that receives a list of
integers
and an integer
and returns a list with the positions in
that contain a number with the digit
.
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__’:
>>> 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) []