LearnPy Hub
← Inheritance & Special Methods problems
Medium

Vector Addition

Write a Vector with x and y, __add__, __mul__ (by a number) and __str__ showing (x, y). Read two vectors and k; print a + b and a * k.

Input

Two lines 'x y', then k.

Output

Two lines.

Sample 1

Input
1 2
3 4
2
Output
(4, 6)
(2, 4)

Sample 2

Input
0 0
0 0
5
Output
(0, 0)
(0, 0)
solution.py
Output appears here
Vector Addition · Python practice problem · LearnPy Hub