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, 22.06.2019 03:00
Check my work the microprocessor is a(n) circuit, which is designed to process data based on a set of instructions. most desktop and laptop devices contain a microprocessor based on the standard. most tablets and smartphones contain processors based on technology. a microprocessor's circuitry is designed to perform a limited number of tasks contained in its set. during processing, an instruction is loaded into the processor's unit. data is loaded into registers in the processor's where arithmetic and logic operations are performed. microprocessor performance can be measured by its speed. other factors affecting overall processing performance include word size, cache size, and instruction set complexity. most digital devices contain only one microprocessor chip, but today's multi- processors contain circuitry that supports parallel processing. computers contain various kinds of memory. random memory is a special holding area for data, program instructions, and the system. it stores data on a temporary basis until the processor makes a data request. ram is different from disk storage because it is , which means that it can hold data only when the computer power is turned on. computers also contain read- memory, which is a type of non-volatile memory that provides a set of "hard-wired" instructions, called the loader, that a computer uses to boot up.
Answers: 3
question
Computers and Technology, 23.06.2019 06:00
When is a chart legend used a. all the time b. whenever you are comparing data that is the same c. whenever you are comparing multiple sets of data d. only for hand-drawn charts
Answers: 2
question
Computers and Technology, 24.06.2019 00:20
Describe a data structures that supports the stack push and pop operations and a third operation findmin, which returns the smallest element in the data structure, all in o(1) worst-case time.
Answers: 2
question
Computers and Technology, 25.06.2019 06:30
Which component is typically used as an amplifier a battery a transistor a microchip a diode
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
Mathematics, 21.04.2020 17:55
question
Mathematics, 21.04.2020 17:55
question
Mathematics, 21.04.2020 17:55
question
Spanish, 21.04.2020 17:55
Questions on the website: 13722363