Dynamic typing vs static typing

def search(self, nums: List[int], target: int) -> int:

pyton allows any paramters and return any value , so what is the use of writing parameters this way