웹 사이트에서 대부 계산기를 만들려고하고 있는데 파이썬 코딩에 문제가 있습니다. 코드는 다음과 같습니다.대부 계산기의 파이썬 코딩 문제
# user enter the cost of the loan, the interest rate, and
#the number of years for the loan
#Calculate monthly payments with the following formula
# M = L[i(1+i)n]/[(1+i)n-2]
# M = monthly payment
# L = Loan amount
# i = interest rate (for an interest rate of 5%, i = 0.05)
# n = number of payments
#________________________________________________________________________#
#Start of program
#Declare variables
monthlypayment = 0
loanamount = 0
interestrate = 0
numberofpayments = 0
loandurationinyears = 0
loanamount = raw_input("Lending Money ")
interestrate = raw_input("Interest Rates are? ")
loandurationinyears = raw_input("Time Duration in Years?")
#Convert the strings into floating numbers so we can use them in the formula
loandurationinyears = float(loandurationinyears)
loanamount = float(loanamount)
interestrate = float(interestrate)
#Since payments are once per month, number of payments is number of years for the loan
payments = loaninyears*12
#calculate the monthly payment based on the formula
payment = amount * interestrate * (7+ interestrate) * payments/((1 + interestrate) * payments -1)
#Result to the program
print("Payment will be " + st(monthlypayment))
경험이있는 사람이이 코딩에서 구문이나 다른 논리적 오류를 얻을 수 있도록 도와 줄 수 있습니까?
가'loaninyears'가 정의되지 않은 you_may_place_some_underscores_in_them. 너는 12를 곱하고있다. – MYGz
'print ("지불은"+ st (monthlypayment))'나는'st'가 여기에'str'이어야한다고 생각한다. – MYGz
amount는 아마 loanamount이어야하고 결코 0 이외의 값을주지 않는다. –