Standardize Mobile Number Using Decorators

  • + 0 comments
    def wrapper(f):
        def fun(l):
            # complete the function
            decorated_list = []
            for ph_num in l:
                decorated_list.append("+91 {} {}".format(ph_num[-10:-5], ph_num[-5:]))
    
            f(decorated_list)
        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)