Closures and Decorators

Standardize Mobile Number Using Decorators

def wrapper(f):
    def fun(l):
        return f(f'+91 {each[-10:-5]} {each[-5:]}' for each in l)

    return fun


@wrapper
def sort_phone(l):
    print(*sorted(l), sep='\n')


if __name__ == '__main__':
    l = [input() for _ in range(int(input()))]
    sort_phone(l)

Decorators 2 - Name Directory

Last updated

Was this helpful?