LearnPy Hub
← Inheritance & Special Methods problems
Easy

__str__ in a Child Class

class Item has a name and __str__ returning the name. class Food(Item) overrides __str__ to return NAME (food). Read a name and print a Food object.

Input

One line.

Output

One line.

Sample 1

Input
rice
Output
rice (food)

Sample 2

Input
mango
Output
mango (food)
solution.py
Output appears here
__str__ in a Child Class · Python practice problem · LearnPy Hub