__str__ and __repr__

Lab Python Intermediate 20 points

Create Point(x, y) whose __str__ returns (x, y) and whose __repr__ returns Point(x=X, y=Y). Read two numbers and print the point with print(p) and then print(repr(p)).

Input

One line: x y.

Output

Two lines.

Example

Input

3 4

Output

(3, 4)
Point(x=3, y=4)
Sample input available Sample output available
Editor
Python

Hints

print() uses __str__; repr() and the interactive shell use __repr__.

Solution explanation

__str__ is for people, __repr__ is for developers and debugging.

Show solution
class Point:
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def __str__(self):
        return f"({self.x}, {self.y})"

    def __repr__(self):
        return f"Point(x={self.x}, y={self.y})"


p = Point(*map(int, input().split()))
print(p)
print(repr(p))
Output
Answer
HOME LEARN COMMUNITY DASHBOARD