Saint Louis University |
Computer Science 150
|
Dept. of Math & Computer Science |
Topic: Recursion
Related Reading: Zelle 13.2
Due:
1:10pm, Monday 5 December 2005
Please make sure you adhere to the policies on academic integrity.
For both of these problems, you could always type in the specified code fragments and let Python answer the questions for you, however you are strongly advised to first attempt these problems by hand! (as these are the type of problems which might be seen on an exam)
Write a recursive method __contains__(self,value) for use within the OurList class. This should return True if the list contains the value, and False otherwise.
Zelle's Chapter 13, "Discussion" question 4 (page 462)
Zelle's Chapter 13, "Programming Exercise" question 3 (pages 463)
Zelle's Chapter 13, "Programming Exercise" question 4 (pages 463)
Write a recursive method __getslice__(self,i,j) for use within the OurList class. This method should return a new instance of OurList which represents the slice self[i:j]. You may assume that integers i and j are non-negative.
Remember that the original list should not be mutated when computing a slice, or subseuqently modifying that computed slice.