Why am I not able to sort the resultant list??
def func(str): return len(str) a = input("Enter:").split(" ") p = list(zip(a,list(map(func,a)))) p.sort(reverse=False) print(p)
In that case your code is much more complicated than needed. You can just take an input, make it a list, and print out the longest word (using the max() function), and the length of it (so you will need len(max(input))). Try that and I'll help if you need it
It is sorting correctly. Maybe it's not sorting as you want, how do you want it to sort?
Here's the task: I will enter a sentence and i need to return the max length in it along with the word Ex: Input: "I love programming" Output: (Programming,11)
Thank you 😀