Created
February 20, 2019 14:40
-
-
Save Ventsislav-Yordanov/8e7f8bb619e3ecbde799140fc977fbaf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List | |
Vector = List[float] | |
def scale(scalar: float, vector: Vector) -> Vector: | |
return [scalar * num for num in vector] | |
# typechecks; a list of floats qualifies as a Vector. | |
new_vector = scale(2.0, [1.0, -4.2, 5.4]) | |
print(new_vector) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment