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...


PYTHON


Write a python function called calc_toll() that has three different parameters such as: the current hour of time (int), whether the time is morning (boolean), and whether the day is a weekend (boolean). The function also should returns the correct toll fee (float), based on the information in the picture.


PHOTO 1: toll fee & given arguemnts with expected output
PHOTO 2: STARTER CODE


Weekday Tolls<br>• Before 7:00 am ($1.15)<br>• 7:00 am to 9:59 am ($2.95)<br>• 10:00 am to 2:59 pm ($1.90)<br>• 3:00 pm to 7:59 pm ($3.95)<br>• Starting 8:00 pm ($1.40)<br>Weekend Tolls<br>• Before 7:00 am ($1.05)<br>• 7:00 am to 7:59 pm ($2.15)<br>• Starting 8:00 pm ($1.10)<br>Ex: The function calls below, with the given arguments, will return the following toll fees:<br>calc_toll(8, True, False) returns 2.95<br>calc_toll(1, False, False) returns 1.90<br>calc_toll(3, False, True) returns 2.15<br>calc_toll(5, True, True) returns 1.05<br>

Extracted text: 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
1 def calc_toll(hour, is_morning, is_weekend):<br>2<br># Type your code here.<br>3<br>4 if _name_ == '_main__':<br>print(calc_toli(8, True, False))<br>print(calc_tol1(1, False, False))<br>print(calc_tol1(3, False, True))<br>print(calc_tol1(5, True, True))<br>7<br>8<br>9<br>

Extracted text: 1 def calc_toll(hour, is_morning, is_weekend): 2 # Type your code here. 3 4 if _name_ == '_main__': print(calc_toli(8, True, False)) print(calc_tol1(1, False, False)) print(calc_tol1(3, False, True)) print(calc_tol1(5, True, True)) 7 8 9

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here