A forum for general discussion of the Python programming language.


Postby murster972 » Sun Sep 08, 2013 1:03 pm

the instructions where:
Finish the function make_payment that takes the inputs payment and balance.

Have the function print the string "You still owe: x", with x being the amount that you still owe. Then return the amount you still owe. Remember to add interest to the final amount!

We went to a hotel for 5 nights. We then decided to pay half the bill. Then we decided to pay another 100 dollars. At the end of your code, make sure to print out how much we still owe. (Check the hint if you need help!)

the best i could get was:
Code: Select all
def hotel_cost(nights):
    return nights * 140

bill = hotel_cost(5)

def add_monthly_interest(balance):
    return balance * (1 + (0.15 / 12))

def make_payment(payment, balance):
    balance_ = balance - payment
    return add_monthly_interest(balance_)
new_bill = make_payment(bill / 2, bill)
make_payment(100, new_bill)
Posts: 20
Joined: Fri Jul 19, 2013 8:54 pm

Re: help...again

Postby hansn » Sun Sep 08, 2013 4:12 pm

Are the hints from codeacademy not helpful at all?

What part don't you understand? I'm not one to analyze ones code when some simple information would make it much easier to help you.

If you try to submit your code to codeacademy you get quite accurate error messages on where you went wrong, don't you? (at least you do on javascript)
I only looked briefly at your code but I think you forgot to print how much you still owe.
Posts: 87
Joined: Thu Feb 21, 2013 8:46 pm

Return to General Discussions

Who is online

Users browsing this forum: Bing [Bot] and 2 guests