Find String in String with Python (sentence, word)
def find_your_word_from_sentence(sentence, word):
n=0
while n
check = sentence.find(word[n])
if check ==-1:
return "Your Word is not found in given sentence."
n=n+1
return word
print find_your_word_from_sentence('This is city of technolgy, piano and
violine also found here', 'techvolatile')
Output:
techvolatile
Comments
Post a Comment