> > > It didn't have to do with strings. It was a basic example of using > append() which is to start with an empty list and and then build it > incrementally: > > >>> l = [ ] > >>> l.append(1) > # append more > > Hi Amit,
Ok, good. This context helps! If you do know all the values of the list up front, then defining 'f' with those values as part of the list literal is idiomatic: l = [1, ## fill me in... ] and in this way, we probably wouldn't use append() for this situation. The reason for this can be based on readability arguments: a programmer who sees this will be more inclined to know that the list won't change. Symmetrically, the presence of 'l.append()' in a program is often a hint a reader to anticipate the need for the list to have some dynamic, runtime-dependent size. Good luck!
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor