|
def main():
age = int(input("Enter your age:"))
months = int(input("Enter number of months of service:"))
firstHigh = eval(input("Enter first of three highest salaries:"))
secondHigh = eval(input("Enter second of three highest salaries:"))
thirdHigh = eval(input("Enter third of three highest salaries:"))
annualPension = average(firstHigh,secondHigh,thirdHigh) * rate(months)
print("Annual pension:${0:,.2f}".format(annualPension))
def average(a,b,c):
ave = (a + b + c) / 3
return ave
def rate(a):
yrs = a // 12
perRate = 5 * 0.015 + 5 * 0.0175 + (yrs - 10) * 0.02
p = min[0.8,perRate]
return p
main()
Traceback (most recent call last):
File "C:\Users\sunqi\退休金.py", line 20, in <module>
main()
File "C:\Users\sunqi\退休金.py", line 7, in main
annualPension = average(firstHigh,secondHigh,thirdHigh) * rate(months)
File "C:\Users\sunqi\退休金.py", line 17, in rate
p = min[0.8,perRate]
TypeError: 'builtin_function_or_method' object is not subscriptable
|
|