Collections: Difference between revisions

Line 1,253:
y = collection[0] # now returns a string of "-1"
collection.extend([2,'3']) # same as [collection.append(i) for i in [2,'3']] ... but faster
collection += [2,'3'] # same as previous line
collection[2:6] # a "slice" (collection of the list elements from the third up to but not including the sixth)
len(collection) # get the length of (number of elements in) the collection
Anonymous user