testing and debugging you could try and test it on the supplied -string input but it might be more sensible to begin by trying it on something smaller in factit would make sense to test it on minimal non-palindromee silly( enter elementa enter elementb the good news is that it fails even this simple testso you don' have to type in thousand strings the bad news is that you have no idea why it failed in this casethe code is small enough that you can probably stare at it and find the bug (or bugshoweverlet' pretend that it is too large to do thisand start to systematically reduce the search space often the best way to do this is to conduct binary search find some point about halfway through the codeand devise an experiment that will allow you to decide if there is problem before that point that might be related to the symptom (of coursethere may be problems after that point as wellbut it is usually best to hunt down one problem at time in choosing such pointlook for place where there are some easily examined intermediate values that provide useful information if an intermediate value is not what you expectedthere is probably problem that occurred prior to that point in the code if the intermediate values all look finethe bug probably lies somewhere later in the code this process can be repeated until you have narrowed the region in which problem is located to few lines of code looking at sillythe halfway point is around the line if ispal(resultthe obvious thing to check is whether result has the expected value[' '' 'we check this by inserting the statement print result before the if statement in silly when the experiment is runthe program prints [' ']suggesting that something has already gone wrong the next step is to print result roughly halfway through the loop this quickly reveals that result is never more than one element longsuggesting that the initialization of result needs to be moved outside the for loop the corrected code for silly is def silly( )"""assumes is an int gets inputs from user prints 'yesif the sequence of inputs forms palindrome'nootherwise""result [for in range( )elem raw_input('enter element'result append(elemprint result if ispal(result)print 'yeselseprint 'nolet' try thatand see if result has the correct value after the for loop it doesbut unfortunately the program still prints yes nowwe have reason to believe that second bug lies below the print statement solet' look at ispal the line if temp =xis about halfway through that function sowe insert the