Created
June 13, 2021 07:40
-
-
Save sameerg07/71a47152e29f4c8db5df8098b40773d7 to your computer and use it in GitHub Desktop.
sort list of tuples with key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ast,sys | |
input_str = input() | |
input_list = ast.literal_eval(input_str) | |
sorting_choice = input() | |
# Your code goes here | |
print(sorted(input_list,key=lambda x: x[int(sorting_choice)-1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment