어떻게 같은 def에서 def를 호출 할 수 있습니까? 난 내가하고 싶은 말은 그 :상기 함수 내에서 함수 호출하기
def cal(cal):
stat = stat_dict()
profile = profile_dict()
skill = skill_dict()
... Abreviation....
elif cal == 'Phy': return round(stat['Str']*4 + stat['Con']/3 + stat['End']/2 + stat['Tou']/4 + stat['Agi']/6)
elif cal == 'Inv': return round(cal('Phy') * (1 + skill['Hauling']/20))
내가 마지막 줄에 CHAGE 수 있다는 사실을 알고 :
elif cal == 'Inv': return round((stat['Str']*4 + stat['Con']/3 + stat['End']/2 + stat['Tou']/4 + stat['Agi']/6)* (1 + skill['Hauling']/20))
심지어 :
def cal(cal):
stat = stat_dict()
profile = profile_dict()
skill = skill_dict()
X = round(stat['Str']*4 + stat['Con']/3 + stat['End']/2 + stat['Tou']/4 + stat['Agi']/6)
.... Abreviation...
elif cal == 'Phy': return X
elif cal == 'Inv': retunr X * (1 + skill['Hauling']/20
을하지만 난 원하지 않는 그러기 위해서 개인적인 이유로 같은 뜻을 표현하고 싶습니다. 가능합니까? 내 영어로 미안해.
"defs"가 아니라 "functions"라고합니다. –
당신은 그것을 할 수 있습니다. 그냥 변수와 함수를 같은 이름으로 호출하지 마십시오. http://www.python-course.eu/recursive_functions.php 참조하십시오. –
이들은 함수이며,이 함수 내에서 함수를 호출하는 것을 재귀라고합니다 . –