Lab 5: Taking a Vacation

Description

This is the 6th lab so far that we’ve used python as our Source, In this lab we will introduce a new section that is called taking a vacation and in this section of python we will be taking into concern the bill of how much we will spend in days in the hotel, also the transportation that will be needed to stay in this vacation and finally and how much the total cost of everything in general as saying we are trying to figure out using ideology of if/elif/else the result of the bill. And in each section here it will be breaking down what we will be trying to accomplish which is trying to find the how much we owe in the days we spent in the car rental, the days spend in the hotel and also the final bill. Using new features and coding in this section it will be easier to figure out how we will get the solution faster.

Code

This is the following code of the recent lab i made in python. This lab is called Lab 5 Taking A Vacation and in this lab as you can see we are trying to find a solution to not owe anything on the bill and with ideology and help from python i found a way how to find a solution to this issue. First lets break down what this code means. First we begin with a new function defining hotel cost of the number of nights that was spent, as you see the total of those nights was 140. Next we set bill as a variable equal to the hotel cost and the 5 in the () is the amount of days that was stayed in the hotel. next we def a function of the bill breaking it down by typing add_monthly interest to its balance. Next we get the output to return that function and the numbers are what was defined with the 2 bills. Finally we make one more function and this time we define the payment and the remaining balance of the bill, after all this commotion the balance is owing first bill in 354. 375 and the other 275.5546875. And that is the conclusion to Lab 5 Taking a Vacation.

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):
 after = balance - payment
 newbill = add_monthly_interest(after)
 print "You still owe: ", newbill 
 return newbill
bill = make_payment(bill / 2, bill)
bill = make_payment(100, bill)

Screenshot

This is the screenshot of the following Lab 5 Taking a vacation… As you can see here there are two screenshots that show the conclusion of the result i got in this section of python. The one on the left is the screenshot that shows the final step of the lab which is 16/16 and here when you look at the screenshot you can see that you see the coding that i typed to figure out the final part to this lab, the last step was just to click the result to none because nothing was owed in the vacation. And in the right is another screenshot but this screenshot only shows whats printed in the console and as you see it says none it has to say that because again nothing else is owed to the hotel. And that concludes the Lab 5 Taking a Vacation.

lab 5  lab 5 22

Leave a Reply

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