<div class="im">On 23 August 2012 15:17, Victoria Homsy <span dir="ltr"><<a href="mailto:victoriahomsy@yahoo.com" target="_blank">victoriahomsy@yahoo.com</a>></span> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">
<br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><div class="im"><div style="background-color:transparent">def isPalindrome(s):</div>
<div style="background-color:transparent"><span style="white-space:pre-wrap">        </span>if len(s) <= 1: return True</div><div style="background-color:transparent"><span style="white-space:pre-wrap">        </span>else: return s(0) == s(-1) and isPalindrome (s[1:-1])</div>
<div style="background-color:transparent"><span style="white-space:pre-wrap">        </span></div></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><br></div><div class="im"><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">
I don't see why this wouldn't work...</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">
Many thanks in advance. </div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">
Kind regards,</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">
Victoria <br></div></div></div></div></div></div></blockquote><br>Parentheses
are used for function arguments in Python, whereas square brackets are
used for slices - so the first character of s is not s(0) but s[0].<br><br>
When you say s(0) and s(-1), Python thinks you're calling s as a
function with 0 or -1 as the argument - hence, "str object is not
callable".