Looking for answers? Westonci.ca is your go-to Q&A platform, offering quick, trustworthy responses from a community of experts. Get expert answers to your questions quickly and accurately from our dedicated community of professionals. Our platform provides a seamless experience for finding reliable answers from a network of experienced professionals.

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