Skip to content
C

Problem 1: Vector Addition and Scalar Multiplication

Easypython

Problem Description

Write a Python program using NumPy that takes two vectors of the same length and a scalar value, then prints their element-wise sum and the result of multiplying the first vector by the scalar.

Input

Two vectors of equal length, and a scalar number.

Output

The resulting sum vector and the scaled vector.

Constraints

  • Both vectors must have the same number of elements.

Example Input

text
vector_a = [1, 2, 3], vector_b = [4, 5, 6], scalar = 2

Example Output

text
Sum: [5 7 9] Scaled Vector A: [2 4 6]

Concepts Covered

NumPy arrays, vector addition, scalar multiplication.

Input (stdin)

Output

Run your code to see output here...