[Tutor] Issue with Python
Daniel Williams
dw0391 at gmail.com
Fri Nov 14 00:07:08 CET 2014
Hi, I'm dw0391
I have an issue with a class task that my teacher can't seem to fix.
We were asked to write the code for a 'no interest loan repayment
calculator'. I tried, but it did not work.
Attached is the relevant file, 'Prog 6'
Could you please tell me what I am doing wrong?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20141114/768d2198/attachment.html>
-------------- next part --------------
# No Interest Loan Repayment Calculator
# How to work out how much a person will need to pay per month:
print (
"""
Loan Repayment Calculator
This programs calculates how much you need
to pay each month to pay off a loan,
because maths hurts your head:
"""
)
def payrate(loantotal, timetotal):
rate = loantotal / timetotal
return rate
def main():
loantotal = float(input("Total of Loan: $"))
timetotal = float(input("Time Provided (in months):"))
rate = payrate(loantotal, timetotal)
print ("You need to pay:"% rate, "each month")
main()
input("\n\nPlease Press the Enter key to Exit.")
More information about the Tutor
mailing list