Computers and Technology, 25.11.2020 06:40 kcwolford03
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.
Answers: 1
Computers and Technology, 22.06.2019 12:40
In a response of approximately 50 words, explain why it would be essential for the successful a/v technician to participate in additional coursework, presentations and seminars offered by equipment manufacturers as well as annual conferences attended by colleagues in the industry.
Answers: 1
Computers and Technology, 23.06.2019 17:00
What are the 12 colors of the spectrum called?
Answers: 1
Computers and Technology, 23.06.2019 18:00
Which finger presses the h key on the keyboard? index finger on the left hand pinky finger on the right hand index finger on the right hand thumb on the left hand
Answers: 1
Computers and Technology, 23.06.2019 22:50
What is an rss reader used for? for creating a user account on a social new site
Answers: 2
PYTHON Program using Functions with Parameters
Write a PYTHON program to calculate the total cost o...
French, 12.11.2020 01:00
English, 12.11.2020 01:00
Mathematics, 12.11.2020 01:00
History, 12.11.2020 01:00
Health, 12.11.2020 01:00
Social Studies, 12.11.2020 01:00
Mathematics, 12.11.2020 01:00
Arts, 12.11.2020 01:00
Computers and Technology, 12.11.2020 01:00
Biology, 12.11.2020 01:00
Mathematics, 12.11.2020 01:00