# Python One-Liners for seemingly complex tasks

Save time & effort implementing these in your day to day coding sessions

# Sort a dictionary based on multiple conditions

The above code sorts the dictionary based on the **value first **(In this case 2,2,3,1)**,** if more than 2 keys have the same value then the sorting takes place based on the **length of the key** (Since there are 2 keys with the same value as 2, the sorting now takes place based on the length of the keys IN & GE) if the lengths of the 2 keys are the same then the sorting takes place **finally on the key itself **(Here the keys IN & GE are of the same length thus they will be sorted alphabetically) which gives us the final dictionary.