extending list python provides method named extend that is used to add all elements of one list to the end of second list in effecta call to data extend(otherproduces the same outcome as the codefor element in otherdata append(elementin either casethe running time is proportional to the length of the other listand amortized because the underlying array for the first list may be resized to accommodate the additional elements in practicethe extend method is preferable to repeated calls to append because the constant factors hidden in the asymptotic analysis are significantly smaller the greater efficiency of extend is threefold firstthere is always some advantage to using an appropriate python methodbecause those methods are often implemented natively in compiled language (rather than as interpreted python codesecondthere is less overhead to single function call that accomplishes all the workversus many individual function calls finallyincreased efficiency of extend comes from the fact that the resulting size of the updated list can be calculated in advance if the second data set is quite largethere is some risk that the underlying dynamic array might be resized multiple times when using repeated calls to append with single call to extendat most one resize operation will be performed exercise - explores the relative efficiency of these two approaches experimentally constructing new lists there are several syntaxes for constructing new lists in almost all casesthe asymptotic efficiency of the behavior is linear in the length of the list that is created howeveras with the case in the preceding discussion of extendthere are significant differences in the practical efficiency section introduces the topic of list comprehensionusing an example such as squares for in range( + as shorthand for squares for in range( + )squares append( kexperiments should show that the list comprehension syntax is significantly faster than building the list by repeatedly appending (see exercise - similarlyit is common python idiom to initialize list of constant values using the multiplication operatoras in [ to produce list of length with all values equal to zero not only is this succinct for the programmerit is more efficient than building such list incrementally