Standardize Mobile Number Using Decorators

Sort by

recency

|

214 Discussions

|

  • + 0 comments

    def wrapper(f): def fun(l, *args): # complete the function l = [str(i)[-1: -11: -1][::-1] for i in l] out = ["+91 "+ str(i[:5]) + " " + str(i[5:]) for i in l] out = f(out) return fun

  • + 0 comments
    def wrapper(f):
        def fun(l):
            l = [f"+91 {x[-10:-5]} {x[-5:]}" for x in l]
            f(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)
    
  • + 0 comments
    from re import sub
    def wrapper(f):
        def fun(l):
            return f([sub(r"(.*){0,3}(\d{5})(\d{5})$",\
            r"+91 \2 \3", num)for num in l])
        return fun
    
  • + 0 comments
    
    
    def fun(l):
        formatted_numbers = ["+91 " + num[-10:-5] + " " + num[-5:] for num in l]
        f(formatted_numbers)
    return fun
    
  • + 0 comments

    def wrapper(f): def fun(l): return f(j[::-1] for j in [i[:-11:-1][:5]+ " " + i[:-11:-1][5:] +" 19+" for i in l]) return fun