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 term for the typical layout of the keys on a keyboard?
stepan [7]
I think the answer is B
3 0
3 years ago
Read 2 more answers
Some languages are traditional programming languages for developing applications; others, such as markup and scripting languages
pentagon [3]

Answer:

XML (Extensible Markup Language):

Explanation:

XML (Xtensible Markup Language):

It is a markup language that is used for creating web-pages, it defines a set of rules that makes it readable both to humans and machine.

XML was primarily designed to be a software and hardware independent tool and it's focus was on data.  XML provides a framework for defining markup languages.

XML, HTML and XHTML are all related to each other because they are all markup languages and can be used to build websites.

Basically,

-HTML is primarily for web-pages.

-XML is primarily for data.

-XHTML is a standard based on HTML that follows the strict rules of XML.

6 0
3 years ago
In discussing inventory, Helena mentions that bikinis for sale on the website are not always in stock. Say customer feedback ind
alekssr [168]

Answer:

decide that when online customers and retail stores order bikinis, they will never have to wait more than two weeks for the order to arrive.

Explanation:

Based on the information provided within the question it can be said that in this scenario the best action that Helena can take is to decide that when online customers and retail stores order bikinis, they will never have to wait more than two weeks for the order to arrive. Otherwise she will begin to lose customers constantly by not having stock or shipping the product in time. These losses will continue to amass and may eventually ruin her business.

6 0
3 years ago
Write an application that counts the total number of spaces contained in a quote entered by the user.
mylen [45]

Answer:

Explanation:

The following code is written in Java. It asks the user for an input and saves it in a String variable. Then it loops through all the characters in the string and counts the spaces. Finally, it prints the total number of spaces in the String.

public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter Line Now:");

       String userInput = in.nextLine();

       int spaceCount = 0;

       for (int x = 0; x < userInput.length(); x++) {

           if (userInput.charAt(x) == ' ') {

               spaceCount++;

           }

       }

       System.out.println(spaceCount);

   }

3 0
2 years ago
What is the difference between a programming language and natural (every-day) language?
marta [7]

Answer:

Explanation:

Natural languages are used for communication between people and programming languages enable human to interact with machines.

8 0
3 years ago
Other questions:
  • One of the original forms of viruses, is usually stored on some form of removable media. When the removable media is connected t
    9·1 answer
  • Which access control principle specifies that no unnecessary access to data exists by regulating members so they can perform onl
    11·1 answer
  • PLEASE HELP!!!!! David has gone to the Niagara Falls with his camera. He wants to click photos of the people around him and also
    11·2 answers
  • Rachel wants to post content from digital cameras on the web. Which online tool will help Rachel to post and edit content on a w
    5·1 answer
  • What is the square root of 1600 and 36 ?​
    6·1 answer
  • What are the pros and cons of using ICT
    5·1 answer
  • Which letter would appear in the third position of the standard wheel marking of a hard-grade wheel?
    10·2 answers
  • If you had an idea for a new software company, what would be the best approach to help make it a successful business? develop a
    5·2 answers
  • Write a program that will generate a personalized invitation within a text file for each guest in the guest list file using the
    15·1 answer
  • HELP FAST
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!