Answered Essay: fare(num_stops, age, is_rush hour, want_return_fare, num_pets): Given how far to go, how old the pass

fare(num_stops, age, is rush hour, passenger is, whether its rush hour or not, whether they want to purchase a return fare at current prices, and how many pets they are bringing with them, calculate the full price according to the following rules: ant_return_fare, num_pets): Given how far to go, how old the kids under age 5 ride any distance free each transported pet adds S1 per ride, regardless of distance or age or rush hour in rush hour, 0-10 stops costs $8 for the distance, all longer trips cost $12. outside of rush hour, pricing is the exact same as with simple_fare (its quite possible to call that function and reuse its efforts!) a return ticket may be purchased at the same time for the same price. (perhaps we could leave after morning rush hour but return cheaply during evening rush hour by buying the ticket off-peak). senior citizens (age 65+) pay half as much for the distance/pet choice, never paying more than $4 per ride (including pet costs), even during rush hour. (fare for return ride may also cost up to $4). dont worry about returning e.g. 3 vs 3.e; when we check equality they are considered equal o o o o o o o

fare(num_stops, age, is_rush hour, want_return_fare, num_pets): Given how far to go, how old the passenger is, whether it’s rush hour or not, whether they want to purchase a return fare at current prices, and how many pets they are bringing with them, calculate the full price according to the following rules: kids under age 5 ride any distance free each transported pet adds $1 per ride, regardless of distance or age or rush hour. in rush hour, 0-10 stops costs $8 for the distance, all longer trips cost $12. outside of rush hour, pricing is the exact same as with simple_fare (it’s quite possible to call that function and reuse its efforts!). a return ticket may be purchased at the same time for the same price. (perhaps we could leave after morning rush hour but return cheaply during evening rush hour by buying the ticket off-peak). senior citizens (age 65+) pay half as much for the distance/pet choice, never paying more than $4 per ride (including pet costs), even during rush hour. (fare for return ride may also cost up to $4). don’t worry about returning e.g. 3 vs 3.0: when we check equality they are considered equal.

Expert Answer

 

Program Screenshots:

# Use python 3.5 or 3.6

Sample Output:

Code to Copy:

# Inundation of the code should be same as provided in above screenshots:

# Use python 3.5 or 3.6

# definition of the function
def simple_fare(num_stops):

#assign value to variable
st=num_stops

# Declare variable
fare = 0
# check whether stops less than equal to 5
if st <=5:

# Calculate the fare
fare=fare+st

# return fare.
return fare
else:

# update value of fare
fare= st-5
# check whether stops less than equal to 6
if st <=6:

# Calculate the fare
fare=fare+st*0.50

# return fare
return fare
else:

# update the fare
fare= fare +3

# Update the value of fare
st=st-6
# check whether stops less than equal to 8
if st <=8:
# update the value of fare.
fare=fare+st*0.25

# return fare
return fare
else:

# Update the value of fare
fare=fare+2

# update value of stops.
st= st-8
return fare

#Definition of the function
def fare(num_stops,age,is_rush_hour,want_return_far,num_pets):

# declare variable
result=0

# check whether age less than 5
if age < 5:

# Updaet value of result.
result=0
return result
# Update the value of result.
result=result+num_pets

# check whether it is rust hour or not.
if is_rush_hour:
# check whether the num_stops greater than 10
if num_stops > 10:
# update the value of result.
result=result+12
else:
# Update the value of result
result=result+8
else:

#update the value result
# Call to the function
result=result+simple_fare(num_stops)

# check whether age greater than 65
if age >=65:

# update the value of result
result=result/12

# check whether the result greater than 4
if result >4:

result=4
# check whether the fare is required.
if want_return_far:

# Update the value of result.
result=result*12
return result

# Call to the function
print(fare(1,20,False,False,15))

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.