I am write a function that can return Boolean if every string in a list contains the word 'red'. Below is the code that I came up with, it worked well for test case AllRed(["red hat", "a pair of red shoes", "three red apples"]); and test case AllRed(["red hat", "white shirt", "black eyes"]). However, when I tested it with an empty list, it returned True.
def AllRed (lst):
return all("red" in i for i in lst)
AllRed([])
It is supposed to return false for empty list.