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
What is the python print of (“5”+”7”)?
Firdavs [7]

Answer:

57

Explanation:

Since the 5 and the 7 don't represent integers instead they represent strings so it would come out as 57 hope I helped!

4 0
2 years ago
Jason is working on a project that requires him to manage a huge amount of data. The spreadsheet he is working on has data relat
Alinara [238K]

A. use split worksheet view to break the worksheet into different visible sections

<u>Explanation:</u>

Jason is working on a project that requires him to manage a huge amount of data. There are numerous instances when a user has to manage a huge amount of data within a single spreadsheet. It will cause trouble for the user to simultaneously access the data from more than one table in the same sheet.

To deal with this problem, Jason can track and compare this data as he works on the spreadsheet by using the split worksheet view to break the worksheet into different visible sections. The different sections provide a better view of the tables and data extraction and manipulation become easy.

6 0
3 years ago
We have an internal webserver, used only for testing purposes, at IP address 5.6.7.8 on our internal corporate network. The pack
lukranit [14]

Answer:

Check the explanation

Explanation:

A packet filter firewall is used as a check point between internal corporate network to the outside internet. It blocks all the inbound traffic from the outside hosts trying to initiate a direct TCP connection to the internal corporate webserver. The network design with firewall is shown in the attached image below:

The figures in the attached image below shows an internal corporate network is protected with a packet filter firewall to minimize the inbound traffic from the external network or an internet. Therefore, the packet filter is used as a check point between the network.

The packet filter blocks all attempts by the outside hosts in order to initiate a direct TCP connection to the internal webserver of the internal corporate network.

Going by the second part of the attached image below can can therefore conclude that:

• Rule 1 specifies that, deny any packet with the destination address 5.6.7.8 if the STN flag of TCP header is set.

• Rule 2 specifies that, allow the inbound email traffic from the external source.

• Rule 3 specifies, allows the Outbound TCP traffic from the internal corporate network.

• Rule 4 specifies, allows outbound Email traffic from the internal corporate network to the external network.

• Rule 5 specifies, block any traffic from any source to the any destination.

3 0
2 years ago
How will I go about conducting the investigation on fake news
Leno4ka [110]

Answer:

You can begin your report, and write about CNN, BBC, or any other liberal news network.

Explanation:

5 0
2 years ago
What does amelia heart and the wright brothers have in common
expeople1 [14]

Answer:

they are stepbro and step sis and they fucx

Explanation:

7 0
2 years ago
Other questions:
  • Waterpower was first harvested by ancient societies using
    5·1 answer
  • A network administrator issues the show vlan brief command while troubleshooting a user support ticket. What output will be disp
    15·2 answers
  • Write an application that inputs a telephone number as a string in the form (555) 555-5555. The application should use String me
    10·1 answer
  • What is the output of 1101 x 10 == 11000 + 10?
    12·1 answer
  • Assume that the array arr has been defined and initialized with the values {4, 2, 5, 3, 1}. What are the values in the array arr
    15·1 answer
  • Determine the exact output of the code $str = "The quick brown fox jumps over the the lazy dog"; echo strpos($str, 'fox');
    6·1 answer
  • PLEASE HURRY!!!
    11·1 answer
  • Write a program, named NumDaysLastNameFirstName.java, which prompts the user to enter a number for the month and a number for th
    13·1 answer
  • State the functions of all the parts of the computer​
    14·1 answer
  • Plzzz help i need this today :(
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!