Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python beginner
#1
Hi all,

I am new to Python (really enjoying it so far) and am working my way through Learn Python the hard way. I have just learnt about functions and decided to go off piste and make myself a question to solve. I can't find the answer online, so was wondering if you good people can help me.

Problem PART A : I am trying to work out how much of my mortgage is left after X months of repayment. In this case, amount borrowed - 200000, Interest rate 0.03 per anum, time: 72 months, paying back 750 a month:

def mortgage(borrowed, repayment, interest, time):
    print(f"total left after {time} months \n")
    print(borrowed * (interest/12 +1)-repayment)  #this calculates mortgage left after 1 month. How do I repeat this calculation on the answer? 71 times

mortgage(200000,750,.03,72)
Many Thanks,

BigD :)
Reply


Messages In This Thread
Python beginner - by BigDisAok - Jun-23-2018, 11:18 AM
RE: Python beginner - by Nwb - Jun-23-2018, 11:57 AM
RE: Python beginner - by BigDisAok - Jun-23-2018, 12:23 PM
RE: Python beginner - by gontajones - Jun-23-2018, 01:08 PM
RE: Python beginner - by BigDisAok - Jun-23-2018, 01:12 PM
RE: Python beginner - by gontajones - Jun-23-2018, 01:21 PM
RE: Python beginner - by Grok_It - Jun-24-2018, 04:55 PM
RE: Python beginner - by gontajones - Jun-24-2018, 05:08 PM
RE: Python beginner - by Grok_It - Jun-24-2018, 05:27 PM
RE: Python beginner - by gontajones - Jun-24-2018, 05:30 PM
RE: Python beginner - by Grok_It - Jun-24-2018, 05:37 PM
RE: Python beginner - by BigDisAok - Jun-25-2018, 09:01 AM
RE: Python beginner - by buran - Jun-25-2018, 10:18 AM
RE: Python beginner - by Grok_It - Jun-25-2018, 06:36 PM
RE: Python beginner - by buran - Jun-25-2018, 06:41 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020