Sequential Search using Python

The Sequential search algorithm is a searching algorithm. To implement this algorithm, we start by searching for the target value from the beginning of the array and continue till we find the target value. In this article, I will take you through the implementation of Sequential Search using Python.

Sequential Search Algorithm

The searching algorithms are the algorithms that are used to search a particular value in a data structure such as lists in Python. The sequential search is a searching algorithm that checks each item in a data structure from the beginning to find the target value.

For example, imagine that you are trying to find a specific card from a deck of cards. You will go through each card in the deck one by one until you find the card you are looking for. Once you got the card you were looking for you will stop. This is how the sequential search algorithm works. Now, in the section below, I will take you through an implementation of sequential search using the Python programming language.

Sequential Search using Python

I hope you now know what a sequential search algorithm is and how it works. To implement this algorithm, we need to check each element from the beginning until we find the value we are looking for. Now let’s see how to implement sequential search using Python:

def sequential_search(list_, n):
    for i in list_:
        if i == n:
    return True

In the Python code above, I have defined a Python function with two parameters(list_, n) the “list_” indicates the Python list and “n” indicates the item we want to search in a list. Then I am simply using a for loop to search for n in the list. Now let’s see how to use the above function for implementing the sequential search algorithm:

elements = range(0, 20)
ss = sequential_search(elements, 4)

Also, Read – Python Projects with Source Code: Solved and Explained.


The sequential search is one of those algorithms which are popular in every coding interview. To implement it, you have to search for the target value from the beginning of the data structure until you find the target value. I hope you liked this article on the implementation of Sequential Search using Python. Feel free to ask your valuable questions in the comments section below.

Default image
Aman Kharwal

I am a programmer from India, and I am here to guide you with Data Science, Machine Learning, Python, and C++ for free. I hope you will learn a lot in your journey towards Coding, Machine Learning and Artificial Intelligence with me.


  1. HI SIR. I HAVE IMPLEMENTED THIS CODE IN JUPYTER NOTEBOOK. I AM JUST GETTING “TRUE” as Output for whichever value i am giving. I didn’t understand this?. If I am giving n value greater than 20, even then I am getting True as Output.

Leave a Reply

Data Science | Machine Learning | Python | C++ | Coding | Programming | JavaScript