LearnPy Hub
← Inheritance & Special Methods problems
Medium

Truthiness of an Object

Write class Basket holding items with __len__ and __bool__ (true when it holds at least one item). Read items on one line (a single - means no items) and print has items or empty using if basket:, then the length.

Input

One line.

Output

Two lines.

Sample 1

Input
apple banana
Output
has items
2

Sample 2

Input
-
Output
empty
0
solution.py
Output appears here
Truthiness of an Object · Python practice problem · LearnPy Hub