Question: In this midterm coding exercise zyLab, you have unlimited Develop Mode runs and unlimited Grade Mode submissions. Make sure you complete both zyLabs for full

In this midterm coding exercise zyLab, you have unlimited Develop Mode runs and unlimited Grade Mode submissions. Make sure you complete both zyLabs for full credit.
Toll roads have different fees based on the time of day and on weekends. Write a function calc_toll() that has three parameters: the current hour of time (int), whether the time is morning (boolean), and whether the day is a weekend (boolean). The function returns the correct toll fee (float), based on the chart below.
Weekday Tolls
Before 7:00 am ($1.15)
7:00 am to 9:59 am ($2.95)
10:00 am to 2:59 pm ($1.90)
3:00 pm to 7:59 pm ($3.95)
Starting 8:00 pm ($1.40)
Weekend Tolls
Before 7:00 am ($1.05)
7:00 am to 7:59 pm ($2.15)
Starting 8:00 pm ($1.10)
Ex: The function calls below, with the given arguments, will return the following toll fees:
calc_toll(8, True, False) returns 2.95
calc_toll(1, False, False) returns 1.90
calc_toll(3, False, True) returns 2.15
calc_toll(5, True, True) returns 1.05 In this midterm coding exercise zyLab, you have unlimited Develop Mode runs and unlimited Grade Mode submissions. Make sure you complete both zyLabs for full credit.
Toll roads have different fees based on the time of day and on weekends. Write a function calc_toll() that has three parameters: the current hour of time (int), whether the time is morning (boolean), and whether the day is a weekend (boolean). The function returns the correct toll fee (float), based on the chart below.
Weekday Tolls
- Before 7:00 am (\$1.15)
-7:00 am to 9:59 am (\$2.95)
-10:00 am to 2:59 pm (\$1.90)
-3:00 pm to 7:59 pm (\$3.95)
- Starting 8:00 pm (\$1.40)
Weekend Tolls
- Before 7:00 am (\$1.05)
-7:00 am to 7:59 pm (\$2.15)
- Starting 8:00 pm (\$1.10)
Ex: The function calls below, with the given arguments, will return the following toll fees:
calc_toll(8, True, False) returns 2.95
calc_toll(1, False, False) returns 1.90
calc_toll(3, False, True) returns 2.15
calc_toll(5, True, True) returns 1.05
599438.4569076.qx3zqy7
LAB
ACTIVITY
13.1.1: EXAM: Midterm Programming 1
main.py
```
def calc_toll(hour, is_morning, is_weekend):
# Type your code here.
if __name__=='__main__':
print(calc_toll(8,-True, False))
print(calc_toll(1, False, False))
print(calc_toll(3, False, True))
print(calc_toll(5, True, True))
```
In this midterm coding exercise zyLab, you have

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!