from itertools import combinations


def PS(n):
    """
    Returns powerset of n (excluding null set)
    """

    P = []
    for sz in range(1, n+1, 1):
        # create all possible combinations of size i
        temp = combinations(range(n), sz)
        for item in temp:
            P.append(item)
    return P