Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started