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 types of roles are there as a webmaster?
Nuetrik [128]
<span> PHP, ASP, and Javascript. They handle the technical aspects </span>
6 0
3 years ago
Read 2 more answers
You have been employed as a technical consultant to a computer shop chain. You are given the task of creating a short consumer b
brilliants [131]

Answer:

The five factors to consider when trying to choose between a Solid State Drive, a Hard Disk Drive and, an External Hard Disk Drive are:

  1. Read/Write Speed
  2. Weight
  3. Power Consumption
  4. Cost
  5. Storage Capacity

  • Solid State Drives (SSDs) are typically lighter in weight, faster and do not consume much power.
  • Hard Disk Drives are relatively cheaper than SSDs. They also come with higher storage capacities but are more power-hungry and slower because they rely on mechanical/moving parts to read and write data.
  • External HDDs are the cheapest of the three. They are not internal which is a major drawback given the additional weight. However, they come with gargantuan storage capacities that make you want to rethink having one. Besides, unlike SSDs, you can easily get them in computer accessories shops offline or online.

Cheers!

3 0
3 years ago
Everfi module 7 answers
Nat2105 [25]
What is the question?
7 0
2 years ago
What wired channel, commonly used for cable tv, consists of an insulated copper wire wrapped in a solid or braided shield placed
Airida [17]
the answer is A coaxial cable
8 0
3 years ago
If you are going to attach more than 15 devices to your wireless network, you should make sure your router supports which standa
Westkost [7]

Answer:

802.11ac

Explanation:

It is a wireless networking standard.It functions only on 5 Ghz only. 802.11ac has three times the bandwidth of 802.11n hence it can handle more number of users.It has multi-link throughput of 1 gigabit per second.It provides high throughput.It is very useful for environments with high user density.

3 0
3 years ago
Other questions:
  • This type of connection uses radio waves to connect devices on a network.
    9·2 answers
  • Which device or software application detects errors in system configurations?
    8·1 answer
  • An element in a web page that connects to a different location in the same page or a different page is a _____.
    8·1 answer
  • WHAT DOES THE WORD MONOCHROME MEAN?
    11·1 answer
  • Create a structure named planet This structure will contain distance from Earth as an integer Atmosphere, language, people and p
    8·1 answer
  • The term that describes the connection of all kinds of devices; computers, phones, laptops, appliances, cars, etc. to the intern
    7·1 answer
  • A column letter above the grid, also called the ____, identifies each column.
    9·1 answer
  • The IT department sent out a memo stating that it will start delivering desktop computer interfaces through the IT data center v
    5·1 answer
  • Write the class RoadSegmet. The class inherits from Transportation Class. The Class have a vector hourlySpeeds data field which
    14·1 answer
  • In the EXPLORE online library, the ratio of the number of novels to that of dictionaries is 2:3 and the total number of novels i
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!