Python type hints - creating a type alias


Python tip:

You can create a type alias to make your code more readable.

from typing import List

Vector = List[float]


def scale(scalar: float, vector: Vector) -> Vector:
    return [scalar * num for num in vector]