Lab 5: Taking a Vacation

Description: Showed how to use python in real life situations and how to use functions property in more advanced ways

Code: def hotel_cost(nights):
return nights * 140

bill = hotel_cost(5)

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

def make_payment(balance, payment):
newBalance = (balance – payment)
balanceAndInterest = add_monthly_interest(newBalance)
print “You still owe: %f” % balanceAndInterest
return balanceAndInterest

newbill = make_payment(bill,(bill/2))

print make_payment(newbill, 100)

 

ScreenShot:

Untitled

Leave a Reply

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