Search a word from Sentence in Python

It's an simple python program for to search the word is present in the String or not.Here we are using an if condition to check the word is present in the sentence are not.

Source code :

Sentence = "The window is red and the door is blue!"
word = "blue"
if word in Sentence: 
   print 'Present'
   
else:
    print 'Not Present'

Output :

Present

Output :


                

Comments :