Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 3.0 via PyCharm Purpose: To write a function that performs a subtask and returns an answer. Degree of Difficulty: Easy A travel agent would

Python 3.0 via PyCharm

image text in transcribed

Purpose: To write a function that performs a subtask and returns an answer. Degree of Difficulty: Easy A travel agent would like to compute the total cost of a trip that includes a flight, plus a number of nights at a hotel for a group of people. The agent is assuming double occupany, which means two will share each each night you could use the formula number-of-people // 2 number-of-people % 2 + Write a Python function trip cost that takes four parameters as input and returns the total cost of the trip. The four parameters should be the airfare in dollars, the room cost per night in dollars, the number of people, and the number of nights. Ask the user to input values for each of the function arguments from the console. You may assume that the user supplies valid input. Call the trip_cost function with the arguments you read from the console and output the its return value to the console. Sample Run Here is an example of how your program's console output might look. Green text was entered by the user blue text came from data returned by the function. Calculate Trip Cost Enter cost of flight (S) 1000 Enter cost of a double room per night:100.00 Enter the number of people 11 Enter the number of nights:7 The total cost of the trip for the group is $15200.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions