Question: Program for python Write a function that takes as two parameters: the zone and the duration, and returns the Barcelona metro and bus (TMB) fare.
Write a function that takes as two parameters: the zone and the duration, and returns the Barcelona metro and bus (TMB) fare. If the zone is 1 and duration is "oneDay," the fare is 7. If the zone is 1 and the duration is "tenRide," the fare is 9.45. If the zone is 1 and the duration is "oneMonth," the fare is 50.95. If the zone is 2 and duration is "oneDay," the fare is 11.15. If the zone is 2 and the duration is "tenRide," the fare is 18.75. If the zone is 2 and the duration is "oneMonth," the fare is 74.85. If the zone is greater than or equal to 3, return a negative number (since your calculator does not handle inputs that high). You should include in the file a main) that calls your function several times to demonstrate that it works. Hint: zone is an integer and duration has a string value. Different combinations result in a particular fare. Use iif ...elif elif...else... logic to come up with the fare The conditions in that chain of questions could be compound one using the connective and
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
