def calc(num):
if num == 1:
return 1
else:
return [2 * calc(num-i) + math.pow(2,i) - 1 for i in range (1, num)]
当我运行它时,它给了我这个错误:
TypeError: can only concatenate list (not "float") to list. How can i fix this?
def calc(num):
if num == 1:
return 1
else:
return [2 * calc(num-i) + math.pow(2,i) - 1 for i in range (1, num)]
当我运行它时,它给了我这个错误:
TypeError: can only concatenate list (not "float") to list. How can i fix this?