• Python question of the day

    What would be the output of executing the following code:
    k = [(10,'ten'),(11,'eleven'),(12,'twelve')]
    k.sort(key=lambda k: k[1])
    print(k[0][1])
     10
     ten
     eleven
     twelve
    Explanation:
    Here the key defines that the list should be sorted by the second value of the tuple, string.


    Top 100 python interview questions:


  • python bootcamp 2021
datai analytics