LearnPy Hub
← Inheritance & Special Methods problems
Medium

Multiply a Vector by a Number

Write class Vec with x and y, __mul__ for v * k, __rmul__ so k * v also works, and __str__ as (x, y). Read x, y and k and print v * k and k * v.

Input

x y k on one line.

Output

Two lines.

Sample 1

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

Sample 2

Input
0 0 5
Output
(0, 0)
(0, 0)
solution.py
Output appears here
Multiply a Vector by a Number · Python practice problem · LearnPy Hub