LearnPy Hub
← Inheritance & Special Methods problems
Medium

A Mixin That Describes

Write class DescribeMixin with describe() returning ClassName(attr=value, …) from vars(self). Make class Book(DescribeMixin) with title and pages and class Pen(DescribeMixin) with colour. Read lines book TITLE PAGES or pen COLOUR until END and print each object's describe().

Input

Lines, then END.

Output

Lines.

Sample 1

Input
book Python 300
pen blue
END
Output
Book(title=Python, pages=300)
Pen(colour=blue)

Sample 2

Input
pen red
END
Output
Pen(colour=red)
solution.py
Output appears here
A Mixin That Describes · Python practice problem · LearnPy Hub