Lab 5

Lab Description:  I  was  assigned  to  complete  “Taking a Vacation”  from  codeacademy.  It  had  requested  that  I  write  a  code  that  involves  a  larger  amount  of  knowledge  than  my  last  lab.

Code:

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):
    return add_monthly_interest(balance-payment)
new_bill = make_payment(bill/2, bill)
new_bill = make_payment(100, new_bill)

print new_bill

Screenshots:

vacation

Leave a Reply

Your email address will not be published. Required fields are marked *