In python the method parameter types need not be specified. Python dynamically interprets them.
But in some code snippets I see the type being defined.
def method(p1: int, p2: int) -> None
1) Why is this done 2) for other data structures i need to define only the data structure and not type of the parameters it is accepting
def multiply(num1: list, num2: list):
Why is the purpose of such a design.
and why i am not allowed to define the type of the list
def multiply(num1: list[int], num2: list[int]):