Westonci.ca is the Q&A platform that connects you with experts who provide accurate and detailed answers. Explore thousands of questions and answers from knowledgeable experts in various fields on our Q&A platform. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields.

In a particular jurisdiction, taxi fares consist of a base fare of $4.00,
plus $0.25 for every 140 meters traveled. Write a function that takes
the distance traveled (in meters) as its only parameter and returns
the total fare as its only result, but converts the meters to miles
within the function, [1 km --> 0.621371 miles] and displays both the
amount of kilometers and its conversion to the user, plus the total
amount due. (American travelers like to see this conversion in European
or Latin American countries)

Format the output so that it includes a dollar sign, and

The result should always display two decimal places.

in python btw

Sagot :

def cost(meters):

   miles = (meters*0.621371)/1000

   cost = 4 + (0.25 * (meters/140))

   print("The meters you travelled is " + str(meters) + " in meters and " + str(miles) + " in miles. And your cost is $" + str(cost))