a guest Nov 26th, 2011 31 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 2. Python’s set objects have a method called pop that removes and
  2. returns an arbitrary element from the set. If a set gerbils contains
  3. five cuddly little animals, for example, calling gerbils.pop()
  4. five times will return those animals one by one, leaving the set
  5. empty at the end. Use this to write a function called mating_pairs
  6. that takes two equal-sized sets called males and females as input
  7. and returns a set of pairs; each pair must be a tuple containing
  8. one male and one female. (The elements of males and females may
  9. be strings containing gerbil names or gerbil ID numbers—your
  10. function must work with both.)
RAW Paste Data