Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Summer 2006- Questions on Recursion

Questions?


def reverse (string):
 if string == " ":
  return " "
 return reverse (string [1:]) + string [0]


You need to check for an empty string. if string == "": There should be no space in between. You also need to fix the indentation. After that, it'll work. - Bobby Mathew

def decreaseRed(alist):
 if alist == []:
  return
 setRed(alist[0], getRed(alist[0]*.8)
 decreaseRed(alist[1:])

You need a closing ')' after the setRed statement. That should work provided the input is getPixels(picture). - Bobby Mathew

def findlength (string):
 if string == " ":
  return 0
 return len(string)

That's right, apart from the indentation. - Bobby Mathew



Link to this Page