Intro to
Programming
with Python

Fall 2012
course
navigation

Nov 29

Comments posted on work submitted so far. Looks like a good start ... though in most cases not as far along yet as I would have hoped for.
Let's do a few examples of recursion. (From the previous homework I think there are still a few questions there - particularly about making smaller version of lists and strings.)
def palindrome(word): """ Return True if word is a palindrome >>> palindrome("a") True >>> palindrome("cat") False >>> palindrome("dad") True """ print "in palindrome: word = ", word if len(word) <= 1: return True elif word[0] != word[-1]: return False else: return palindrome(word[1:-1])
Big review of everything we've done :
http://cs.marlboro.edu/ courses/ fall2012/python/ notes/ Nov_29
last modified Thursday November 29 2012 11:01 am EST