defwrapper(f):deffun(l):returnf(f'+91 {each[-10:-5]}{each[-5:]}'for each in l)return fun@wrapperdefsort_phone(l):print(*sorted(l), sep='\n')if__name__=='__main__': l = [input()for _ inrange(int(input()))]sort_phone(l)
Decorators 2 - Name Directory
defperson_lister(f):definner(people):return [f(each)for each insorted(people, key=lambdax: int(x[2]))]return inner@person_listerdefname_format(person):return ("Mr. "if person[3]=="M"else"Ms. ") + person[0]+" "+ person[1]if__name__=='__main__': people = [input().split()for i inrange(int(input()))]print(*name_format(people), sep='\n')