python fun
This blog is a reference guide to the analytics which are suppose to address in upcoming blogs. Python This section covers only the Python Sort with Lambda As first, I would like to introduce how lambda can be used to sort the dictionary of word count (wc) based on the key or the value(name of the fruit and the count) __author__ = 'ojitha' wc ={ 'orange' : 2 , 'mango' : 1 , 'cherry' : 8 , 'apple' : 5 } '''sort on key''' print(sorted (wc.items(), key= lambda (word, count): word)) ''' sort on the count''' print(sorted (wc.items(), key= lambda (word, count): count)) The output of the above code is as follows [('apple', 5), ('cherry', 8), ('mango', 1), ('orange', 2)] [('mango', 1), ('orange', 2), ('apple', 5), ('cherry', 8)] List Comprehensions List of even and odds can be created as follows listOfEve...