total
のprint(result)
関数が私の結果を出力していません。関数の戻り値の出力
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を使用しています。
'result = sums(firstAge、secondAge)' – janos