There was an error while loading. Please reload this page.
1 parent 9605dcb commit 5f33863Copy full SHA for 5f33863
programs/sort_dict_by_value.py
@@ -0,0 +1,9 @@
1
+data = {
2
+ 'one':1,
3
+ 'two':2,
4
+ 'four':4,
5
+ 'three':3
6
+}
7
+
8
+sort_dict = {key:val for key,val in sorted(data.items(),key= lambda x : x[1]) }
9
+print(sort_dict)
0 commit comments