Sort and reverse elements in list,reverseelements,scores = ['1
Sort and reverse elements in list,reverseelements,scores = ['1
scores = ['1','2','3']scores.sort()for score in scores: print scorescores.reverse() # want the highest number first# list high-score tablefor score in scores: print score
相关内容
- List slice assignment: delete and insert,sliceassignment,L = ['spam
- List slicing,listslicing,numbers = [1
- A tuple consists of a number of values separated by commas,tuplecom
- tuple assignment,tuple,nudge = 1win
- Empty tuples are constructed by an empty pair of parentheses,tuples
- List inside a tuple,listinsidetuple,T = (1, [2,
- Tuple assignment in for,tupleassignment,T = [(1, 2),
- Tuple inside a list and reference tuple element,tupleelement,L = ['
- Delete dictionary entry,dictionaryentry,d2 = {'spam'
- Create a dictionary and fetch value by key,dictionaryfetch,d2 = {'s
评论关闭