所以我的问题是我一直在努力解决学习Python的问题(它说这是针对初学者的,我已经完成了它,但是出于某种原因和计算原因,我在使用return函数时遇到了麻烦)。
我需要的find_monthly_savings
功能,走量与多年函数来计算用户需要“每月”保存量,如果amount is < 0
再return None
或者,如果years <= 0
再return None
。
def find_monthly_savings(amount, years): # used to divide the amount by years
return amount / years
def amount(number):
if number < 0:
return None
def years (months):
if years < 0:
return None
find_monthly_savings(amount = 360, years = 1) #calling upon the dms function
干得好:
def find_monthly_savings(amount, years): # used to divide amount by years
if amount < 0:
return None
if years <= 0:
return None
return amount / years
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句