Васил обнови решението на 23.03.2015 16:43 (преди над 9 години)
+def extract_type(couple, type_):
+ return ''.join(list(map(lambda x: x[0] * x[1],
+ filter(lambda x: type(x[0]) is type_, couple))))
+
+
+def reversed_dict(original):
+ return dict(zip(original.values(), original.keys()))
+
+
+def reps(numbers):
+ return tuple([num for num in numbers if numbers.count(num) > 1])
+
+
+def flatten_dict(original):
+ def helper(key, value):
+ if type(value) is dict:
+ return [(key + '.' + k, v) for k, v in flatten_dict(value).items()]
+ else:
+ return [(key, value)]
+
+ return dict([item for k, v in original.items() for item in helper(k, v)])