Question: Using Python 2.7 Consider the following scenario: You might have been driving a little too fast when a police officer stops you. Write code to

Using Python 2.7

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 officers perspective

bday should be a Boolean as to whether it is your birthday or not If 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!