Toll gates have different fees based on the time of day, weekdays/weekends. Write a function that has three parameters: the current hour of time (int), 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 TollsBefore 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 TollsBefore 7:00 am ($1.05) 7:00 am to 7:59 pm ($2.15)Starting 8:00 pm ($1.10)input : toll_fee(8, True, False) Output : $ 2.95

Respuesta :

The program is an illustration of functions

What are functions?

Functions are named program statements that are executed when called

The actual program

The program written in Python, where comments are used to explain each line is as follows:

#This defines the function

def toll_fee(time,weekday,weekend):

   #This determines the toll fee for weekdays

   if(weekday):

       if time < 7:

           return 1.15

       elif time>=7 and time <10:

           return 2.95

       elif time>=10 and time <15:

           return 1.90

       elif time>=15 and time <20:

           return 3.95

       else:

           return 1.40

   #This determines the toll fee for weekends

   elif(weekend):

       if time < 7:

           return 1.05

       elif time>=7 and time <20:

           return 2.15

       else:

           return 1.10

#This calls the toll fee function        

print(toll_fee(8, True, False))

Read more about functions at:

https://brainly.com/question/16397886