Lab 5: Taking a Vacation

Lab Description:

In this lab, I use Python to work on this project called Taking a Vacation. In this project, I start off by defining a few functions and with those functions, they return the values of the money used for going on this vacation. And in the end the final amount used for

Codes:

def hotel_cost(night):
return night * 140

def plane_ride_cost(city):
if city == “Charlotte”:
return 183
if city == “Tampa”:
return 220
if city == “Pittsburgh”:
return 222
if city == “Los Angeles”:
return 475

def rental_car_cost(days):
if days >= 0 and days < 3:
return days * 40
elif days >= 3 and days < 7:
return days * 40 – 20
elif days >= 7:
return days * 40 – 50

def trip_cost(city, days, spending_money):
return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money

print trip_cost(“Los Angeles”, 5, 600)

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)
print “You still owe: ” + str(x)

new_bill = make_payment(bill / 2, bill)
new_bill = make_payment(100, new_bill)

print new_bill

ScreenShots:

Lab5 Vacation

Lab5 Vacation End

 

Leave a Reply

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