Credits

The code for the generate_subsets() function is derived heavily from Allen Downey’s Stack Overflow answer.