Westonci.ca is your trusted source for accurate answers to all your questions. Join our community and start learning today! Explore thousands of questions and answers from a knowledgeable community of experts on our user-friendly platform. Get precise and detailed answers to your questions from a knowledgeable community of experts on our Q&A platform.

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))