how to check for a particular word in a text file using python

file = open("search.txt")
    print(file.read())
    search_word = input("enter a word you want to search in file: ")
    if(search_word in file.read()):
        print("word found")
    else:
        print("word not found")

Here is what the above code is Doing:
1. We are opening the file in read mode.
2. We are printing the contents of the file.
3. We are taking input from the user.
4. We are checking if the word is present in the file or not.
5. If the word is present, we are printing “word found”.
6. If the word is not present, we are printing “word not found”.