What i am trying to do is making a powerset by given set. nums. But i am stuck in a problem right now. I can not understand why python just saying NoneType error...
+Q. I am wondering if list_1 could interact with local list. In my recursion func, i want to discribe 3th argument as list_ but doing like that occurs other problems. maybe process with list_ dont apply to real list list_1.
def powerset(nums):
list_1=[]
recursion(0,nums,list_1)
print (list_1)
def recursion(start,nums,list_1):
if start>len(nums)-1:
list_1.append([])
return 0
recursion(start+1,nums,list_1)
i=0
save_list=list_1
save_len=len(list_1)
while i<save_len:
list_1.extend(save_list[i].append(nums[start]) )
i += 1