Posts

Showing posts with the label Search Engine

Create Basic "Search Engine" in Python

The following script is a very basic search engine in python. It takes user input, checks it against the so-called indexed content and returns the results in decreasing order of match cases. def matches(userQuery, indexedData): count = 0 for wordQ in userQuery.split(" "): for wordS in indexedData.split(" "): if wordQ == wordS.lower(): count += 1 # return f"{count} Result(s) found!" return count # print(f"{count} Result(s) found!") if __name__ == "__main__": sentences = ["python is a beginner-friendly programming language", "it is good to start with python your coding journey", "There are many programming languages", "youtube shorts is a great way to create videos instantly", "car is goood for convenience, bike is better when you are solo"] q...