0

我在 stackoverflow 中阅读了很多关于这个论点的内容。无论如何,当我为它分配一个递归函数时,我无法真正理解变量到底发生了什么!我已经很努力地使用 printNow() 命令只是为了不明白发生了什么.. 但什么也没有,只是一堆 None !

variable = function() #variable is going to be the the return value of function() ?
                      #if function() is a recursive function each time of the recursive, variable
                      #is gonna be different ?

编辑:添加了一段我无法理解的代码..

def permute(seq):

  if len(seq)<=1:
    perm=[seq]
  else:
    perm=[]                          
    for i in range(len(seq)):
      sub=permute(seq[:i]+seq[i+1:]) # What sub is gonna be = ? 
      for p in sub:
        perm.append(seq[i:i+1]+p)      

返回烫发

4

0 回答 0