Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from functools import reduce
- class string(str):
- def __radd__(self, other):
- other = other or ""
- return reduce(str.__add__,("L" , other , "R+" , "R" , self))
- def __add__(self, other):
- other = other or ""
- return reduce(str.__add__,("L" , self , "+" , "R" , other))
- print(sum(map(lambda s:string(s),range(10))))
- print(reduce(string.__add__,map(lambda s:string(s),range(10))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement