Infringement Less than 13km/h over the speed limit At least 13km/h but not more than 20km/h over the speed limit More than 20km/h but not more than 30km/h over the speed limit More than 30km/h but not more than 40km/h over the speed limit More than 40km/h over the speed limit Penalty amount $177 $266 $444 $622 $1.245 Demerit points 1 3 4 6 8 Note: the way the government website has written this (and we've copied it) is NOT efficient in terms of decision structures. This written for each condition to stand alone (if, if, if) but we can tell its mutually exclusive and so know a better tool for the job don Avoid a 6-month suspension by writing a program to ask for the user's: • speed and the • speed limit
program in python?​

Answers

Answer 1

The example of the program in Python to help one to calculate the penalty amount as well as the demerit points based on the speed and speed limit provided by the user is given in the code below

What is the program?

python

def calculate_penalty(speed, speed_limit):

   penalty_amount = 0

   demerit_points = 0

   if speed <= speed_limit:

       return penalty_amount, demerit_points

   overspeed = speed - speed_limit

   if overspeed <= 13:

       penalty_amount = 177

       demerit_points = 1

   elif overspeed <= 20:

       penalty_amount = 266

       demerit_points = 3

   elif overspeed <= 30:

       penalty_amount = 444

      demerit_points = 4

   elif overspeed <= 40:

       penalty_amount = 622

       demerit_points = 6

   else:

       penalty_amount = 1245

       demerit_points = 8

   return penalty_amount, demerit_points

# Get user input

speed = int(input("Enter the recorded speed (in km/h): "))

speed_limit = int(input("Enter the speed limit (in km/h): "))

# Calculate penalty and demerit points

penalty, points = calculate_penalty(speed, speed_limit)

# Display the results

print("Penalty amount: $", penalty)

print("Demerit points: ", points)

Read more about python here:

https://brainly.com/question/30113981

#SPJ1


Related Questions

Other Questions
Draw the structure for (Z)-4-ethyl-3,5-dimethylhex-3-en-2one Which falls outside the principles listed by the American Nurses / ociation (ANA) for public health nursing? Which of the following complexes is/are likely to be coloured? [Cu(OH2)6]+, [V(NH3)6]3+, [V(OH2)6]2+ a(n) ____ is a voluntary agreement of cooperation between firms. Use either a shift in demand of supply to GRAPHICALLY represent each of the following situations. Also, label the graphs correctly and indicate the changes in equilibrium in each case. a) Avocado prices: Reduced water supply in avocado growing regions. b) Electric car market: Increased gasoline price. c) SUV market: Increased gasoline prices. d) Ipad market: Technology improvements reduce the cost of manufacturing. Four separate graphs please. 3. a) How would economic contraction brought about by Covid - 19 slowdown be represented using production possibilities curve? b) How does increased productivity affect the production possibilities curve? One graph for each question. Which of the following term do investors use to describe the their (investors') investments made into the company they own? Their (investors') loan to the company The company's Liabilities Their (investors') Equity Their (investors') Assets Which of the following accounts resets its ending balance to zero (0) of "Beginning Balance" when a new accountting term (like a new year) starts? Accrued Expenses account Common Stock account Labor Expenses account Prepaid Expenses account Which of the following accont groups includes the amount that other people (or companies) owe to your business? Assets Expenses Revenues Liabilities Equity Which financial statement provides you with the amount of Inventory used up during one accounting term? The Balance Sheet The Income Statement Both the Income Statement and the Balance Sheet Which of the following information represents the amount of the total value of a long-term asset offset from the purchase amount? Depreciation Expense in the Income Statement Net Book Value of the equipment presented in the Balance Sheet Accumulated Depreciation in the Balance Sheet Which financial statement provides the information of the amount of debt principal paid during one accounting term? The Cash Flows Statement The Income Statement The Balance Sheet 1 Explain in your own words what a holistic approach to safety means. (10) 6.2 Summarise your understanding of the core aspects of an OSHMS and briefly explain each aspect as it would apply to your organisation. at any given time, molly's spending will be ________ by her ________. Sunny Company manufactures printer parts, and the CEO would like to inves in a new machine to reduce operating costs. The total cost of the machine is$75,000 and the CEO predicts the following net cash flows for the next five years: (Use a Financial calculator or Excel to arrive at the answers.)Year Cash Flow1 $30,0002 35,000.3 38,0004 25,0005 19,000a. If the cost of capital is 11 percent, what is the NPV? (Round the final answer to the nearest whole dollar.)NPV $b. What is the IRR? (Round the final answer to 2 decimal places.)IRR $c. Should the project be accepted?O YesO No Make a table that shows 3 pairs of numbers for the function y = 2x - 2. Then graph these pairs on a coordinate plane and draw a line through these points. What is the slope of the graphed line? Haswell Enterprises' bonds have a 13-year maturity, a 10.95\% coupon, and a par value of $1,000. The going int: 00. The going interest rate (rd) is 11.22\%. Assuming semiannual compounding, what is the bond's price? Round to two decimal places (Ex: s000.00) On January 1, 2022, the Profit Corp. acquired a 40% interest in Little Inc. for $250,000. On that date, Littles balance sheet disclosed assets with a book value of $1,430,000 and liabilities of $1,000,000. A patent on Littles balance sheet is undervalued by $28,000. The patent has a 4-year remaining useful life. Any additional excess cost over fair value is attributable to Goodwill. During 2022, Little reported net income of $100,000 and paid cash dividends of $30,000. You can type directly on this Word document or print and write out your solution to this problem. Upload your solutions at eLearn. Break the cost of the investment into its component parts. Prepare the entry to record the investment in Little: Prepare the necessary entries to apply the equity method to account for the investment. Prepare a T-account for the Investment in Little account showing its balance at 12-31-22. Discussion 3 - The Digestive System Discussion 3 The Digestive System We will be exploring the digestive system after Exam 1. We will begin with this system since typically students are more familiar with this system. It resembles a long conveyor belt, with the mouth at the entrance and the anus at the exit. For your discussion, please choose a disease condition of the gastrointestinal tract and describe in your own words. Please use at least two sentences. Also, please choose a combining form, suffix, and prefix related to the digestive system to post. (Remember to use dash and slash!) Try not to replicate any other discussion postings. As always students are encouraged to comment on each others postings. by definition, a(n) ____ satisfies consumer wants and needs. which aqueous solution of ki freezes at the lowest temperature Identify 5 innovations, explain250 words Additional Algo 10-3 Evaluate Days-of-Supply from Financial Reports In 2017, Coca-Cola reported inventory of $2.655 billion and annual sales of $35.41 billion. What were the days of supply for Coca-Cola? Note: Assume 365 days per year and round your answer to 1 decimal place. Draw the major organic product of the reaction shown below. +HCl - You do not have to consider stereochemistry. - You do not have to explicitly draw H atoms. Draw the major organic product of the reaction shown below. - You do not have to consider stereochemistry. - You do not have to explicitly draw H atoms. By trying solutions of the form x(t)= e^t find the general solution of the third order equation\dx/dt - dx/dt - 4 dx/dt + 4 x = 0Write equation (2) as a first order system and outline how you would find the general solution of this system. Which is the quicker method for finding the general solution? Current Attempt in Progress Tamarisk, Inc., changed from the LIFO cost flow assumption to the FIFO cost flow assumption in 2020 . The increase in the prior year's income before taxes is $1,150,000. The tax rate is 20%. Prepare Tamarisk's 2020 journal entry to record the change in accounting principle. (Credit account titles are automatically indented when amount is entered. Do not indent manually. If no entry is required, select "No Entry" for the account titles and enter 0 for the amounts