Challenge: Operator Overloading
Explore how to overload operators in Python by extending a Vector class. Understand unary negation, subtraction between vectors, scalar multiplication, dot product, and proper error handling when incompatible types are used.
Problem 1
In this challenge, you are required to overload the unary negation operator (-) and the subtraction operator (-) for the Vector class.
- Unary Negation (
-vector): Negates all the components of a vector. - Subtraction (
vector1 - vector2): Performs