subject

PYTHON Program using Functions with Parameters Write a PYTHON program to calculate the total cost of a trip.

Steps:

Define a function called hotel_cost with one parameter no_of_nights . The hotel costs $140 per night. So, the function hotel_cost should return the total cost based on the number of nights.
Define a function called flight_cost with a parameter city. The function should return a different price depending on the location. Below are some sample destinations and their corresponding round-trip prices. You can add more cities to the list. If the input city is not in the list use $250 as the flight cost.
Charlotte - $183 ,Tampa - $220, Pittsburgh - $222, Los Angeles - $475

3. Define a function called rental_car_cost with a parameter called days. Calculate the cost of renting the car: Every day you rent the car costs $40.(cost=40*days) if you rent the car for 7 or more days, you get $50 off your total(cost-=50). Alternatively, if you rent the car for 3 or more days, you get $20 off your total. You cannot get both of the above discounts. Return that cost.

4. Then, define a function called Total_Trip_Cost that takes cities and days(Number of days is a required argument and the cities to visit is an arbitrary tuple *args). Calculate the total trip cost for each given city for the number of days by adding the values returned by the functions rental_car_cost, hotel_cost, and flight_cost.

5. Finally, ask for user input for the number of days for the trip and the list of cities and print the total cost of the trip for each city for the given number of days.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:10
Can be categorized as popularity, relevancy, and user satisfaction. select one: a. mobile search seo b. ranking factors c. serp d. web analytics
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
One of your customers wants you to build a personal server that he can use in his home. one of his concerns is making sure he has at least one backup of their data stored on the server in the event that a disk fails. you have decided to back up his data using raid. since this server is for personal use only, the customer wants to keep costs down. therefore, he would like to keep the number of drives to a minimum. which of the following raid systems would best meet the customer's specifications? a. raid 0 b. raid 1 c. raid 5 d. raid 10
Answers: 3
question
Computers and Technology, 23.06.2019 23:30
Perform an online search about the booting process of a computer and list all the steps
Answers: 2
question
Computers and Technology, 24.06.2019 23:30
Does anyone have the problem where you try to watch a video to get your answer but it brings up a thing asking your gender to make ads relevant but it doesn't load? btw i won't be able to see the answer so use the comments .
Answers: 1
You know the right answer?
PYTHON Program using Functions with Parameters Write a PYTHON program to calculate the total cost o...
Questions
question
Social Studies, 23.01.2020 17:31
Questions on the website: 13722361