Write afunction that takes as two parameters: the zoneand the duration, and returns the Barcelona metro and bus (TMB)fare.
- If the zone is 1 and durationis “oneDay,” the fare is 7.
- If the zone is 1 and theduration is “tenRide,” the fare is 9.45.
- If the zone is 1 and theduration is “oneMonth,” the fare is 50.95.
- If the zone is 2 and durationis “oneDay,” the fare is 11.15.
- If the zone is 2 and theduration is “tenRide,” the fare is 18.75.
- If the zone is 2 and theduration is “oneMonth,” the fare is 74.85.
- If the zone is greater than orequal to 3, return a negative number (since your calculator doesnot handle inputs that high).
You should include inthe file a main() that calls your function several times todemonstrate that it works.
Hint: zone is aninteger and duration has a string value. Different combinationsresult in a particular fare. Use if …elif … elif …else…logic to come up with the fare The conditions in that chain ofquestions could be compound one using the connectiveand
Expert Answer
Answer to Write a function that takes as two parameters: the zone and the duration, and returns the Barcelona metro and bus (TMB) …