Радослав обнови решението на 23.03.2015 16:30 (преди над 9 години)
+def extract_type(sp,typ):
+ ans = ""
+ for a in sp:
+ if type(a[0]) == typ:
+ ans += str(a[0]) * a[1]
+
+ return ans
+
+
+def reversed_dict(dic):
+ ans = {}
+ for key in dic:
+ value = dic[key]
+ ans[value] = key
+
+ return ans
+
+
+def reps(sp):
+ ans = ()
+ for x in sp:
+ br = 0
+ for y in sp:
+ if x == y:
+ br = br + 1
+ if br != 1:
+ ans += (x,)
+
+ return ans
+
+
+def flatten_dict(dic1):
+ ans = {}
+ def flatten_h(dic,bef):
+ for key in dic:
+ if type(dic[key]) != dict:
+ ans[bef+key] = dic[key]
+ else:
+ flatten_h(dic[key],bef+key+'.')
+ flatten_h(dic1,'')
+
+ return ans
+
+
+def unflatten_dict(dic):
+
+ return dic