Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 8(PYTHON!!!!!) In a town, the police wants to take harder measures for drunken bike riders from now on. The fees will increase depending the

Exercise 8(PYTHON!!!!!)

In a town, the police wants to take harder measures for drunken bike riders from now on. The fees will increase depending the alcohol percentage in the blood of the biker. Think of a solution to calculate the fee the drunk biker needs to pay for a given alcohol percentage. Write a function calc_Fine() to print the following messages in the Shell based on the alcohol percentage:

Alcohol percentage < 0.5 : no fee

From 0.5 to 0.8: 50 fee

Over 0.8 to 1.5: the fee increases linearly from 50 at 0.8 to 150 at 1.5

If alcohol percentage > 1.5: 250 fee and you are in a critical condition

If a wrong (negative) value is entered: Error

In the rules above, the percentage is expressed in per mille, however, in your code you can translate this to a float: 0.5 becomes 0.5.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

Use of assessments to determine trainees learning styles.

Answered: 1 week ago

Question

7. Discuss the advantages of embedded learning.

Answered: 1 week ago