Мария обнови решението на 23.03.2015 14:51 (преди над 9 години)
+def reversed_dict(names):
+ dict = {country: city for city, country in names.items()}
+ return dict
+
+import collections
+
+
+def flatten(el, parent_key='', sep='.'):
+ items = []
+ for k, v in el.items():
+ new_key = parent_key + sep + k if parent_key else k
+ if isinstance(v, collections.MutableMapping):
+ items.extend(flatten(v, new_key, sep=sep).items())
+ else:
+ items.append((new_key, v))
+ return dict(items)
+
+
+def unflatten(dictionary):
+ resultDict = dict()
+ for key, value in dictionary.iteritems():
+ parts = key.split(".")
+ d = resultDict
+ for part in parts[:-1]:
+ if part not in d:
+ d[part] = dict()
+ d = d[part]
+ d[parts[-1]] = value
+ return resultDict
+
+
+def reps(numbers):
+ eqq = []
+ for number in numbers:
+ if numbers.count(number) > 1:
+ eqq.append(number)
+ return eqq
+
+
+def extract(list, my_type):
+ return ''.join([x*y for(x, y) in list if isinstance(x, my_type)])
Пусни си примерните тестове. Имената на функциите ти са грешни.