Linear Search Python Code. Python program for linear search. Let s give it name linear search.
It takes a few lines to execute the code which makes it much user friendly language. Now we will define our list in this. List vals 10 20 30 40 50 60 70 80.
Key int raw input please enter a string.
For index in range 0 len list vals. For index in range 0 len list vals. Linear search is usually very simple to implement and is practical when the list has only a few elements or when performing a single search in an unordered list. 1 element x is not present in arr.