Advertisement
maxim_shlyahtin

def_lb1

Mar 21st, 2023
511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. def solve_1(obj):
  2.     input_data = list(map(str, obj.split(',')))
  3.     lst1 = list(map(lambda x: list(x), input_data))
  4.     lst1 = ','.join(list(map(lambda x: ','.join(x), lst1)))
  5.     lst2 = '.'.join(list(filter(lambda x: '@' in x, input_data)))
  6.     lst3 = ' '.join(list(map(lambda x: '№' + x + '№', input_data)))
  7.     return [lst1, lst2, lst3]
  8.  
  9.  
  10. def solve_2(x):
  11.     lst = list(map(int, x.split()))
  12.     lst1 = list(filter(lambda x: x % 2 == 0, lst))
  13.     lst2 = list(filter(lambda x: x % 3 == 0, lst))
  14.     lst3 = list(filter(lambda x: x % 2 != 0 and x % 3 != 0, lst))
  15.     lst3 = list(map(lambda x: -x, lst3))
  16.     res = lst1 + lst2 + lst3
  17.     res = list(map(str, res))
  18.     return ' '.join(res)
  19.  
  20.  
  21. class MyStr(str):
  22.     def islower(self):
  23.         return True if len(list(filter(lambda x: x.isupper(), self))) <= 3 else False
  24.  
  25.     def count(self, value, start=None, end=None):
  26.         my_str = self.lower()
  27.         value = value.lower()
  28.         return my_str.count(value)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement