LearnPy Hub
← Decorators problems
Medium

Default When Nothing Comes Back

Write a decorator factory default(value) whose wrapper returns value when the function returns None. Decorate find(words, letter), which returns the first word starting with the letter or None, with @default('not found'). Read words and a letter and print the result.

Input

Two lines.

Output

One line.

Sample 1

Input
apple banana cherry
b
Output
banana

Sample 2

Input
apple banana
z
Output
not found
solution.py
Output appears here
Default When Nothing Comes Back · Python practice problem · LearnPy Hub