15-112 Fall 2012 Quiz D (Autograded)
45 minutes


Read these instructions first!

Edit the 8 functions as instructed in quizd.py.  Each is worth 12.5 points.

  1. Add a doc string to f1
  2. Use an optional parameter in f2
  3. (Properly) Use variable-Length args in f3
  4. Make f4 a custom comparator function.
    Create a comparator function so that, when used it sorts a list of integers in reverse (largest first)
  5. Make f5 return an anonymous (lambda) function that takes a number x and returns 2*x.
  6. Make f6 take a function f, and return another function (defined within a closure), so that the returned function takes a value x and returns the smallest int value y, where y>=x, such that f(y)==0.
  7. Make f7 solve the Towers of Hanoi. f7(n) should return a list of (from,to) pairs so that making those moves in order would move n disks from post 0 to post 1.
  8. Make f8 take a list L and return the powerset of L.  That is, a list of all possible sublists of L.

carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem