Mar 15 Contest


My son has a card game called Spot it Jr.! Animals that has round cards, with each card showing 6 animals on it. Given any two cards, there is exactly one animal that can be found on both cards. There are a total of 31 unique animals across the cards.

Example Cards


Given a number of animals that will appear on each card and a list of animals, print out the list of cards that need to be generated.


Your submission must be a valid Python (2 or 3) program.
Assuming your main python file is named, then to execute we would call:

$ python num_animals "animal1" "animal2" "animal3" ... "animalN"

Print to standard out a line per card, where each line is a tab delimited list of animal names for the card.


$ python 2 "goat" "lamb" "sea cucumber"
goat  lamb
goat  sea cucumber
lamb  sea cucumber


The results will be judged primarily on correctness, then succinctness of solution, then speed of execution.

I have made a which can be used to verify your program is working correctly.

You can test running it by running:

$ python
'2         goat         lamb    sea cucumber' - success in 0.01 seconds
'2         potato monster     larry    lark' - fail in 0.02 seconds

Submissions Due

Email your solution to by midnight of April 4th.
The test runner can be found at under contests/2015_03_11_animals.