Answer the question
In order to leave comments, you need to log in
How to sort a set array of strings in Python?
The program is given 100 lines of similar content as input, all words in the line are separated by spaces:
<Last name> <grade1> <grade2> <grade3>
How to sort this set by <grade2> for example?
Answer the question
In order to leave comments, you need to log in
score_list = [u'Иванов 4 4 3', u'Петров 5 3 4']
score_list.sort(key=lambda x: int(x.split(' ')[2]))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question