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.
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
animals.py, then to execute we would call:
$ python numbers_game.py 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 animals.py 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
solution_checker.py which can be used to verify your program is working correctly.
You can test running it by running:
$ python solution_checker.py example_animals.py '2 goat lamb sea cucumber' - success in 0.01 seconds '2 potato monster larry lark' - fail in 0.02 seconds
Email your solution to email@example.com by midnight of April 4th.
The test runner can be found at