Write a Python function that takes two parameters: the first a list strings and the second a single string. The function should return True or False depending on whether the string is in the list or not. For example, if the list contains eggs, milk, bananas, and the second parameter is pumpkin, the function should return False.
main.py
def isExist(strList, string):
for word in strList:
if word.lower() == string.lower():
return True
return False
strList = ["eggs", "milk", "bananas"]
string = "pumpkin"
print(isExist(strList, string))
Code Snippet (For Indentation):
Output:
Get Answers For Free
Most questions answered within 1 hours.