Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. from functools import reduce
  2.  
  3. class string(str):
  4.  
  5. def __radd__(self, other):
  6. other = other or ""
  7. return reduce(str.__add__,("L" , other , "R+" , "R" , self))
  8.  
  9. def __add__(self, other):
  10. other = other or ""
  11. return reduce(str.__add__,("L" , self , "+" , "R" , other))
  12.  
  13. print(sum(map(lambda s:string(s),range(10))))
  14. print(reduce(string.__add__,map(lambda s:string(s),range(10))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement