List: display a slice,listdisplayslice,inventory =
List: display a slice,listdisplayslice,inventory =
inventory = ['sword', 'armor', 'shield', 'healing potion']begin = int(raw_input('\nEnter the index number to begin a slice: '))end = int(raw_input('Enter the index number to end the slice: '))print 'inventory[', begin, ':', end, ']\t\t',print inventory[begin:end]
- Getting a List Subset: Slicing,subsetslicing,li = ['a'
- Nested list: two dimensions,nesteddimensions,matrix =
- Demonstrates nested sequences,demonstratesnested,score
- Test for membership with in,testmembership,inventory =
- Defining Dictionaries: shows an example of a dictionary
- Dictionary for loop,dictionaryforloop,dict = {'x':
热门文章:
相关内容
- Getting a List Subset: Slicing,subsetslicing,li = ['a', '
- Nested list: two dimensions,nesteddimensions,matrix = [[1
- Demonstrates nested sequences,demonstratesnested,scores = []#
- Test for membership with in,testmembership,inventory =
- Defining Dictionaries: shows an example of a dictionary definition.,
- Dictionary for loop,dictionaryforloop,dict = {'x':
- Use tuple as key,usetupleaskey,Matrix = {}M
- Define tuple as key in a dictionary,definetuple,Matrix = {}M
- Match two string,matchtwostring,seq1 = 'spam
- String method: to lower case,methodlower,quote = 'Pyt
评论关闭