line print tempx before that line when we run the codewe see that temp has the expected valuebut does not moving up the codewe insert print statement after the line temp xand discover that both temp and have the value [' '' ' quick inspection of the code reveals that in ispal we wrote temp reverse rather than temp reverse()--the evaluation of temp reverse returns the built-in reverse method for listsbut does not invoke it we run the test againand now it seems that both temp and have the value [' '' 'we have now narrowed the bug to one line it seems that temp reverse(unexpectedly changed the value of an aliasing bug has bitten ustemp and are names for the same listboth before and after the list gets reversed one way to fix it is to replace the first assignment statement in ispal by temp [:]which causes copy of to be made the corrected version of ispal is def ispal( )"""assumes is list returns true if the list is palindromefalse otherwise""temp [:temp reverse(if temp =xreturn true elsereturn false when the going gets tough joseph kennedyfather of president kennedyreputedly instructed his children"when the going gets toughthe tough get going " but he never debugged piece of software this subsection contains few pragmatic hints about what do when the debugging gets tough look for the usual suspects have you passed arguments to function in the wrong ordero misspelled namee typed lowercase letter when you should have typed an uppercase oneo failed to reinitialize variableo tested that two floating point values are equal (==instead of nearly equal (remember that floating point arithmetic is not the same as the arithmetic you learned in school) tested for value equality ( compared two lists by writing the expression = when you meant object equality ( id( =id( )) forgotten that some built-in function has side effect one might well wonder why there isn' static checker that detected the fact that the line of code temp reverse doesn' cause any useful computatation to be doneand is therefore likely to be an error he also reputedly told jfk"don' buy single vote more than necessary 'll be damned if ' going to pay for landslide