Question
Alcohol is a drug that is processed by the body in a relatively predictable way. Because alcohol can impair an individual's driving, in Australia you
Alcohol is a drug that is processed by the body in a relatively predictable way. Because alcohol can impair an individual's driving, in Australia you are not legally allowed to drive unless your blood alcohol level (BAL) is below 0.05%. It takes approximately one hour for your BAL to decrease by 0.015.
1. Implement in Python a function, hours to legal limit (bal), that takes an individual's current BAL and returns an integer representing the number of hours that individual must wait before they can legally drive, rounded to the larger number (we want to be on the safe side!). You must use either a for-loop or a while-loop inside your function. The function can be handwritten.
2. Explain why you chose to use one kind of loop instead of the other kind. The explanation can be short, but it must be meaningful.
Step by Step Solution
3.37 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
1Heres a simple implementation of the function in Python Pytho...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