Question
Python Question: Silence of the Lambda (and listsorting) Part 1: Lambda Sorting Write a function named second_sorter that takes in a list ofstrings: def second_sorter(strings):
Python Question: Silence of the Lambda (and listsorting)
Part 1: Lambda Sorting
Write a function named second_sorter that takes in a list ofstrings:
def second_sorter(strings):
# sort the strings based on the 2nd letter
return strings
and does does the following:
returns the strings sorted by the second character.
you must use the sorted function (not the sort method)
you must use a lambda function for the sorter
you can assume each item in strings will be at least 2characters long
The following should work after you are done:
print(second_sorter(["dog", "cat", "snake"]))
Part 1: Lambda Sorting Write a function named second_sorter that takes in a list of strings: def second sorter (strings): # sort the strings based on the 2nd letter return strings and does does the following: returns the strings sorted by the second character. you must use the sorted function (not the sort method) you must use a lambda function for the sorter you can assume each item in strings will be at least 2 characters long The following should work after you are done: print(second_sorter(["dog", "cat", "snake"]))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started