Log in from a computer to take this course

You'll need to log in from a computer to start How to Implement Search Algorithms with Python. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store
Learn

You are a linear search whiz!

You have implemented linear search as a function in Python and used it to find a target value, duplicates, and the largest value in different search lists.

Let’s review what we learned:

Linear search is a search algorithm that sequentially checks whether a given value is an element of specified list by scanning the elements of a list one-by-one until it finds the target value.

Starting with linear search as a subroutine in your code is a useful foundation for constructing algorithms to solve more advanced search problems, such as:

  • Finding duplicates - sequentially search the list for all occurrences of the target value.

  • Finding the maximum value - sequentially scan the list for the largest value and track the largest value seen to date.

The linear_search() function is provided in the text editor.

Test on your own examples!

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?