Python Write Function Named Sortbyindex Takes List Array Lists Arrays Parameter Values Inp Q37241834

in python

Write a function named “sort_by_index” that takes a list/arrayof lists/arrays as a parameter where each of the values of input isa list containing 6 integer values. Sort the input based on thevalues of the fifth value in each list


Answer


def sort_by_index(stores): stores.sort(key=lambda x: x[4]) return stores

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.