January 28th, 2013, 02:05 PM
Join Date: Jan 2013
Time spent in forums: 10 m 16 sec
Reputation Power: 0
A quick easy one
Nevermind ... I'll leave the question for a chuckle. However, it's because 'is_palindrome' should have a Return in front of it.
Silly code, just doing as it was told to.
Can someone please explain this insanity to me.
if len(s) == 0:
print 'i was called'
if s[0:1] == s[(len(s)-1):len(s)]:
i was called
I know, I know, your thinking . . . . well of course this should return True. However, you must remember this is programming a lot of times things just don't make sense. So in this case instead of returning True it ignores that and decides it's going to go with None.
And you get a gold star if you can tell me how you would code it so when it gets to line that says "Return True" it ......
wait for it.