LAB: 5

Taking a Vacation:

Using the Knowledge learned in the previous labs  I was able to created and apply function to real life problems, the first thing I did was to write a function that can solve math problem by doing that I created a function that calculate the cost of hotel, the cost of the ride,the cost of a rental car and calculate the total amount of money for the trip,including days and nights for the city I choose visit.

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

Screenshots:

Taking a Vacation

 

Leave a Reply

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