1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
galina1969 [7]
2 years ago
5

PYTHON --- 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 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)Ex: The function calls below, with the given arguments, will return the following toll fees:calc_toll(8, True, False) returns 2.95calc_toll(1, False, False) returns 1.90calc_toll(3, False, True) returns 2.15calc_toll(5, True, True) returns 1.05
Computers and Technology
1 answer:
Oduvanchick [21]2 years ago
3 0

The toll program illustrates the use of conditional statements;

As a general rule, conditional statements are used to make decisions

<h3>The toll program</h3>

The toll program written in Python where conditional statements are used to make several decisions is as follows:

def calc_toll(hour, morning, weekend):

   toll_fee = 0

   if weekend == False:

       if morning == True:

           if hour < 7:

               toll_fee+=1.15

           elif hour < 10:

               toll_fee+=2.95

           elif hour <= 12:

               toll_fee+=1.90

       else:

           if hour < 3:

               toll_fee+=1.90

           elif hour < 8:

               toll_fee+=3.95

           elif hour >= 8:

               toll_fee+=1.40

   else:

       if morning == True:

           if hour < 7:

               toll_fee+=1.05

           elif hour <= 12:

               toll_fee+=2.15

       else:

           if hour < 8:

               toll_fee+=2.15

           elif hour >= 8:

               toll_fee+=1.10

   return toll_fee

   

Read more about conditional statements at:

brainly.com/question/24833629

#SPJ1

You might be interested in
A distortion of information about the demand for a product as it passes from one entity to the next across the supply chain is c
Rina8888 [55]

Answer:

The answer is "bullwhip".

Explanation:

It is an effect, that exists as a consumer, which has highly unstable to demand and, also, increases perceptions around. It also enables you to defines the System design to have a ripple effect.

  • The purpose of that kind of document is to offer an imaginative analysis of the fiction, complemented by simulations to make the situation more readable.
  • It is a large stock variation, that is triggered specifically by alterations throughout the production of the customers.
8 0
3 years ago
An ip address in the address range 169.254.x.y, used by a computer when it cannot successfully lease an ip address from a dhcp s
Georgia [21]
Yes that is the correct answer


5 0
3 years ago
Where would the information needed to start a computer be stored
Ipatiy [6.2K]

Answer:

the ROM chip

Explanation:

the ROM chip is installed on the motherboard which helps boot the system

6 0
4 years ago
Read the citation example, and then use the drop-down menus to identify each part.
Lemur [1.5K]

Answer:

im notur e

Explanation:

5 0
3 years ago
Read 2 more answers
What is &lt;html&gt;
ipn [44]

the opening tag for an HTML document

8 0
3 years ago
Read 2 more answers
Other questions:
  • 6.67
    5·1 answer
  • What is the difference between chrome and chromium browser?
    9·1 answer
  • How to copy single slide to powerpoint
    15·1 answer
  • When performing conflict management, it is important to identify your;
    6·1 answer
  • How does a layered pattern make use of abstraction and encapsulation?
    10·1 answer
  • The box formed by the intersection of a row and column in a spreadsheet program is known as a ________.
    13·1 answer
  • if you were determining what was expected of you simply by looking at media, what messages would you take away?
    8·2 answers
  • Explain what an IM is, and what is the technology shown in the accompanying figure
    7·2 answers
  • Can someone reply me
    11·1 answer
  • To use the replace feature we can simply just press Carl+h,Carl+c,Carl+r
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!