Question: Please write this in python as the program shown Write a function, computcFare,that takes as two parameters: the zone and the ticket type, and returns
Please write this in python as the program shown
Write a function, computcFare,that takes as two parameters: the zone and the ticket type, and returns the MetroNorth Railroad fare o If the zone is 1 and the ticket type is "peak', the fare is 6.75 o If the zone is 1 and the ticket type is "off-peak", the fare is 5.00 o If the zone is 1 and the ticket type is "senior", the fare is 3.25 o If the zone is 2 and the ticket type is "peak', the fare is 7.50 o If the zone is 2 and the ticket type is "off-peak", the fare is 5.75 o If the zone is 2 and the ticket type is "senior", the fare is 3.75 o If the zone is 3 and the ticket type is "peak', the fare is 9.25 o If the zone is 3 and the ticket type is "off-peak", the fare is 7.00 o If the zone is 3 and the ticket type is "senior", the fare is 4.50 o If the zone is greater than 3, return a negative number (since your calculator does not handle inputs that high) A template program, MNRtransit.py, is available on the CSci 127 repo on github. The grading script does not run the whole program, but instead tests your function separately (unit tests) to determine correctness. As such, the name of the function must match exactly (else, the scripts cannot find it) A sample run: Enter the number of zonea: 2 Enter the ticket type (peak/off-peak): off-peak The fare is 5.75 And another: Enter the number of zonea: 6 Enter the ticket type (peak/off-peak): pea The fare is -1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
