def checkIt(arr,inp):
bool = 0
for i in arr:
if i in inp:
bool = 1
break
return bool
array = ['hi','hey','hello']
string = "Hi there!"
if checkIt(array,string)
print "Yay!";
That's my code. It returns, "Yay!". Now... I like what it does-- it searches the string for a value in an array, and if it finds it, returns true. However, if the string were "What a high mountain!", it would still return true. As you can see, in "high", the characters 'hi' can be found. I'd like it to search for a whole word, rather than a couple characters. How could I do this? Thanks!