Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

Are the rules readily available?

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago