03 - Class Vector

Create vectorclass.py module implementing a Vector class with the following methods:

class Vector:
    def __init__(self,x):
        """
        constructor of the Vector class
        input:
        x - list or tuple of lenght
        sets:
        self.x - tuple: the vector values
        self.n - vector length
        >>> v = Vector([1,2,3])
        """
 
    def scaled_copy(self,scale):
        """ 
        Isotropic scaling, scalar multiplication, in fact
        https://en.wikipedia.org/wiki/Scaling_(geometry)
 
        >>> v = Vector([1,2,3])
        >>> v2 = v.scaled_copy(3)
        >>> v.x
        (1, 2, 3)
        >>> v2.x
        (3, 6, 9)
        """
 
    def __add__(self,other):
        """
        overloading the + operator
 
        :return: Vector object result of the addition, None if not possible (not compatible vectors)
        """

courses/be5b33prg/homework/bonus/03_vector_class.txt · Last modified: 2020/09/14 13:20 by nemymila