IDNLearn.com helps you find the answers you need quickly and efficiently. Our experts provide accurate and detailed responses to help you navigate any topic or issue with confidence.

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