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

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter2: Formatting Workbook Text And Data
Section: Chapter Questions
Problem 3.13CP
icon
Related questions
Question

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
• 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
Transcribed Image 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):
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
Transcribed Image 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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage