Lab 5

Taking Vacation:

Writing the the code for taking a vacation was both hard and easy at the same time. The reason being some parts of the code i grasped to write away with out any problems while others it took me longest to figure out how to operate it. For the most part though all i had to do was take my time while writing the code and not over think it. Which tends to be one of my main problem with coding apart from rushing it. I saw taking a vacation as way of writing a code to calculate how much to you are to pay in total.

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

Capture

Leave a Reply

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