Check out the Pastebin Gadgets Shop. We have thousands of fun, geeky & affordable gadgets on sale :-)Want more features on Pastebin? Sign Up, it's FREE!


By: a guest on Nov 26th, 2011  |  syntax: None  |  size: 0.61 KB  |  views: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print  |  QR code  |  clone
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.)
clone this paste RAW Paste Data