Write a program in python that reads the elements of a set fromthe keyboard, stores them in a set, and then determines itspowerset. Specifically, the program should repeatedly ask theuser:
Enter one more element ? [Y/N]
If the user answers Y then an new element is read from thekeyboard:
Enter the new element in the set:
This cycle continues until the user answers N to the firstquestion. At that point the program shall compute the powerset ofthe set of elements provided by the user, and print it to thescreen. The powerset should not only be printed to the screen, butalso stored in an instance of set.
Important: for what stated above, the elements of the powersetcannot be sets themselves. It is ok to store them in tuples. Notethat while you can use a list to create a set (like in the examplewhere we used list of chars), you cannot store lists in a setbecause of the same reason you cannot store sets inside a set. Forexample, the following code will give you an error
>>> A = [1,2] >>> B = [3,4] >>> C =[A,B] >>> D = set(C) 3---------------------------------------------------------------------------
TypeError Traceback (most recent call last) in ----> 1 D =set(C)
TypeError: unhashable type: ’list’
The reason is that D = set(C) tries to build a set of elementsfrom the list C, and the elements of C are the lists A and B. Onthe contrary, E = set(A) would be ok, because it builds a set fromthe elements of A, and the elements of A are integers.