Isso implementa [[Algoritmo de busca linear]] em [[02 - Notas de literatura/Linguagem de programação Python|Python]].
```python
from typing import List, TypeVar, Optional # Just for option tiping annotations
T = TypeVar('T') # Generic type variable
def linear_search(array: List[T], target: T) -> Optional[int]:
"""Performs linear search on the array for the target element.
Args:
array: List of elements to search through.
target: Element to search for.
Returns:
Index of the target element in the array, or None if not found.
"""
for index, element in enumerate(array): # Use enumerate for cleaner indexing
if element == target:
return index
return None
```