curriculum/challenges/english/blocks/daily-coding-challenges-python/68ee9e3066cfd4eb2328e8a5.md
On November 4th, 2001, Google launched its image search, allowing people to find images using search terms. In this challenge, you will imitate the image search.
Given an array of image names and a search term, return an array of image names containing the search term.
image_search(["dog.png", "cat.jpg", "parrot.jpeg"], "dog") should return ["dog.png"].
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(image_search(["dog.png", "cat.jpg", "parrot.jpeg"], "dog"), ["dog.png"])`)
}})
image_search(["Sunset.jpg", "Beach.png", "sunflower.jpeg"], "sun") should return ["Sunset.jpg", "sunflower.jpeg"].
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(image_search(["Sunset.jpg", "Beach.png", "sunflower.jpeg"], "sun"), ["Sunset.jpg", "sunflower.jpeg"])`)
}})
image_search(["Moon.png", "sun.jpeg", "stars.png"], "PNG") should return ["Moon.png", "stars.png"].
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(image_search(["Moon.png", "sun.jpeg", "stars.png"], "PNG"), ["Moon.png", "stars.png"])`)
}})
image_search(["cat.jpg", "dogToy.jpeg", "kitty-cat.png", "catNip.jpeg", "franken_cat.gif"], "Cat") should return ["cat.jpg", "kitty-cat.png", "catNip.jpeg", "franken_cat.gif"].
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(image_search(["cat.jpg", "dogToy.jpeg", "kitty-cat.png", "catNip.jpeg", "franken_cat.gif"], "Cat"), ["cat.jpg", "kitty-cat.png", "catNip.jpeg", "franken_cat.gif"])`)
}})
def image_search(images, term):
return images
def image_search(images, term):
lower_term = term.lower()
return [img for img in images if lower_term in img.lower()]