g=0
def smooth(self, a, b):
k=0
c = self.name[a]
d = self.name[b]
e,f=c,d
while(e.get_p()!=f.get_p() and e.get_p()!=None and f.get_p()!=None):
k+=1
e=e.get_p()
f=f.get_p()
if(e.get_p==None and f.get_p()!=None):
global g
g+=1
d=d.get_p()
return self.smooth(a,d.name)
return(k,g)
忽略调用的函数,但在 if 语句中它没有更新 g 的值,并给出错误global name 'g' is not defined on call with a value. Please Help