Vector Element-wise Sum
Vectors & Geometry DS practice problem on Onlearn.
Difficulty: easy.
Topics: Understanding Vector Element-wise Sum, Vector Addition, Dimension Checking, List Manipulation, Sentinel Value Logic, Pairwise Iteration, Linear Algebra, Vector Operations, Computational Mathematics, Data Structures, Software Engineering, Vector Arithmetic, Element-wise Operation, Dimension Compatibility, Error Handling, List Comprehension.
Write a Python function that computes the element wise sum of two vectors. The function should return a new vector representing the resulting sum if the operation is valid, or 1 if the vectors have incompatible dimensions. Two vectors (lists) can be summed element wise only if they are of the same length.