Parking¶
The price of a parking is calculated in the following way:
For a time under 60 minutes, the rate is 1.80€.
- For more than 60 minutes, the rate is of 1.80€ plus 0.02€ for each
minute that exceeds the initial 60 minutes.
If the car is parked more than 10 hours, the rate is 13€ without taking into account the previous criteria.
Write the function
price1()that given the time in minutes that a car has been parked in this parking, returns the price to pay (float). Save this function into a file namedparking1.py. Examples:>>> round(price1(39), 2) 1.8 >>> round(price1(61), 2) 1.82 >>> round(price1(220), 2) 5.0 >>> round(price1(563), 2) 11.86 >>> round(price1(600), 2) 12.6 >>> round(price1(601), 2) 13.0 >>> round(price1(1500), 2) 13.0
Note
More tests are provided in the
parking1.txtWrite the function
price2()that given the time in minutes, that a car has been parked in this parking, returns the price to pay as two integer values: euros and cents. Save this function into a file namedparking2.py. Examples:>>> price2(39) (1, 80) >>> price2(61) (1, 82) >>> price2(220) (5, 0) >>> price2(563) (11, 86) >>> price2(600) (12, 60) >>> price2(601) (13, 0) >>> price2(1500) (13, 0)
Note
More tests are provided in the
parking2.txt
Solutions
A solution of these functions is provided in the
parking1.py i
parking2.py