我的整个功能中的打印(结果)不打印我的结果.
sums函数不应该将结果值返回给调用它的函数吗?
这是我的代码:
def main():
#Get the user's age and user's best friend's age.
firstAge = int(input("Enter your age: "))
secondAge = int(input("Enter your best friend's age: "))
total(firstAge,secondAge)
def total(firstAge,secondAge):
sums(firstAge,secondAge)
print(result)
#The sum function accepts two integers arguments and returns the sum of those arguments as an integer.
def sums(num1,num2):
result = int(num1+num2)
return result
main()
我正在使用Python-3.6.1.