Question
Consider the following scenario: You might have been driving a little too fast when a police officer stops you. Write code to determine the type
Consider the following scenario:
You “might” have been driving a little too fast when a police officer stops you. Write code to determine the type of ticket you are to receive and the charge of the ticket. The requirements are as follows:
Define a function called: police
The function should receive 2 arguments: speed, bday speed should receive the speed of the vehicle from the police officer’s perspective bday should be a Boolean as to whether it is your birthday or not
If the speed is 60 or less, the result is a “warning” ticket. If speed is between 61 and 80 inclusive, the result is a “speeding” ticket. If speed is 81 or more, the result is an “excessive speeding” ticket. Unless it is your birthday -- on that day, your speed can be 5 higher in all cases.
Speed < 0 should provide the message 'Speed can not be negative.'
Speed >= 150 should provide the message ''Where's the fire! You're going downtown, Flash!'' For speeding tickets, for every mile an hour over the speed limit, a $10 charge is given.
For excessive speeding tickets, for every mile an hour over the speed limit, a $15 charge is given. The output statement should be from one print statement.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To address the scenario described well define a Pyt...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