We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The other solutions here did nothing to help me actually understand decorators. Yes you can just completely replace the print statement in sort_phone(l)/f(l) by putting one in fun(l), but I don't think that's the intended solution or what decorators are usually used for. Here's another solution:
def wrapper(f):
def fun(l):
l = ['+91 '+num[-10:-5]+' '+num[-5:] for num in l]
return f(l)
return fun
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Standardize Mobile Number Using Decorators
You are viewing a single comment's thread. Return to all comments →
The other solutions here did nothing to help me actually understand decorators. Yes you can just completely replace the print statement in sort_phone(l)/f(l) by putting one in fun(l), but I don't think that's the intended solution or what decorators are usually used for. Here's another solution:
def wrapper(f):