Question 6 - Python function to express power sets


The following data science interview question tests your Python skills. Here they're showing you a basic pattern (power sets) and having you write a function to test for it. This question would also be pretty common for a software engineering position.

Create a python function that generates the power set given a set of values.

For example, if you're given the following set.

set = {1, 2, 3}

Your python function should the corresponding power set.

power set = { {}, {1}, {2}, {3}, {1, 2}, {2, 3}, {1, 3}, {1, 2, 3} }



Ace your next data science interview

Get better at data science interviews by solving a few questions per week