Python: Sort each sublist of strings in a given list of lists using lambda
27. Sort Sublists Lambda
Write a Python program to sort each sublist of strings in a given list of lists using lambda.
Sample Solution:
Python Code :
Sample Output:
Original list: [['green', 'orange'], ['black', 'white'], ['white', 'black', 'orange']] After sorting each sublist of the said list of lists: [['green', 'orange'], ['black', 'white'], ['black', 'orange', 'white']]
For more Practice: Solve these Related Problems:
- Write a Python program to sort each sublist of integers in descending order using lambda.
- Write a Python program to sort each sublist of mixed data types by converting each element to a string using lambda.
- Write a Python program to sort each sublist based on the length of its elements using lambda.
- Write a Python program to sort each sublist in reverse alphabetical order using lambda.
Go to:
Previous: Write a Python program to create the next bigger number by rearranging the digits of a given number.
Next: Write a Python program to sort a given list of lists by length and value using lambda.
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.