<s> import math <EOL> class Vector2 : <EOL> def __init__ ( self , x = <NUM_LIT:0> , y = <NUM_LIT:0> ) : <EOL> self . x = x <EOL> self . y = y <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" % ( self . x , self . y ) <EOL> def from_points ( P1 , P2 ) : <EOL> return Vector2 ( P2 [ <NUM_LIT:0> ] - P1 [ <NUM_LIT:0> ] , P2 [ <NUM_LIT:1> ] - P1 [ <NUM_LIT:1> ] ) <EOL> def get_magnitude ( self ) : <EOL> return math . sqrt ( self . x ** <NUM_LIT:2> + self . y ** <NUM_LIT:2> ) <EOL> def normalize ( self ) : <EOL> magnitude = self . get_magnitude ( ) <EOL> self . x /= magnitude <EOL> self . y /= magnitude <EOL> def __add__ ( self , rhs ) : <EOL> return Vector2 ( self . x + rhs . x , self . y + rhs . y ) <EOL> def __sub__ ( self , rhs ) : <EOL> return Vector2 ( self . x - rhs . x , self . y - rhs . y ) <EOL> A = ( <NUM_LIT> , <NUM_LIT> ) <EOL> B = ( <NUM_LIT> , <NUM_LIT> ) <EOL> C = ( <NUM_LIT> , <NUM_LIT> ) <EOL> AB = Vector2 . from_points ( A , B ) <EOL> BC = Vector2 . from_points ( B , C ) <EOL> AC = Vector2 . from_points ( A , C ) <EOL> print ( "<STR_LIT>" , AC ) <EOL> AC = AB + BC <EOL> print ( "<STR_LIT>" , AC ) </s>
