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
Output appears here