Your First Decorator

Lab Python Advanced 30 points

Write a decorator shout that upper-cases the string returned by the function it wraps. Apply it to greet(name) which returns hello, NAME.

Input

One name.

Output

The shouted greeting.

Example

Input

ada

Output

HELLO, ADA
greet
Sample input available Sample output available
Editor
Python

Hints

A decorator takes a function and returns a new function.

@functools.wraps keeps the original name and docstring.

Solution explanation

@shout above a def is shorthand for greet = shout(greet).

Show solution
import functools


def shout(func):
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        return func(*args, **kwargs).upper()
    return wrapper


@shout
def greet(name):
    return f"hello, {name}"


print(greet(input()))
print(greet.__name__)
Output
Answer
HOME LEARN COMMUNITY DASHBOARD