lists debugging careless use of lists (and other mutable objectscan lead to long hours of debugging here are some common pitfalls and ways to avoid them don' forget that most list methods modify the argument and return none this is the opposite of the string methodswhich return new string and leave the original alone if you are used to writing string code like thisword word strip(it is tempting to write list code like thist sort(wrongbecause sort returns nonethe next operation you perform with is likely to fail before using list methods and operatorsyou should read the documentation carefully and then test them in interactive mode the methods and operators that lists share with other sequences (like stringsare documented atdocs python org/library/stdtypes html#common-sequence-operations the methods and operators that only apply to mutable sequences are documented atdocs python org/library/stdtypes html#mutable-sequence-types pick an idiom and stick with it part of the problem with lists is that there are too many ways to do things for exampleto remove an element from listyou can use popremovedelor even slice assignment to add an elementyou can use the append method or the operator but don' forget that these are rightt append(xt [xand these are wrongt append([ ] append(xt [xt wrongwrongwrongwrongtry out each of these examples in interactive mode to make sure you understand what they do notice that only the last one causes runtime errorthe other three are legalbut they do the wrong thing make copies to avoid aliasing if you want to use method like sort that modifies the argumentbut you need to keep the original list as wellyou can make copy