Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Sample Input and Output: Test Case 1 : Please input truck 1 ' s mass: 4 4 2 5 Please input truck 2 ' s
Sample Input and Output:
Test Case :
Please input truck s mass:
Please input truck s mass:
Please input truck s velocity:
Please input the collision's velocity:
Please input the speed limit in kmh:
Doe, Jane,
Please input the Last name, first name and driver license number for the driver of truck :
Jane Doe, Driver license number: was over the speed limit by kmh They have been fined $
Test Case :
Please input truck s mass:
Please input truck s mass:
Please input truck s velocity:
Please input the collision's velocity:
Please input the speed limit in kmh:
Please input the Last name, first name and driver license number for the driver of truck :
Smith, John,
John Smith, Driver license number: was not speeding!Part :
Write a Python program that asks the user for the following information within Main:
Truck mass, Truck mass, Truck velocity, post collision velocity, speed limit where
the crash took place in and a SINGLE string containing information about the
driver of the truck. The format of this string will be: "Last name, First name, Driver
License Number" you can assume the user will always input this string in the correct
format
Your program must have two functions at the top of your Python file. The first function
will be the solution to your parametric modeling from Part remember you must make
use of parameters and returns for any function you are writing based on a PM solution
Your second function must take in the following values as parameters: The calculated
speed of Truck the speed limit where the crash took place, and the SINGLE
formatted string see above The function should first convert the speed of Truck into
The function should then calculate how far over or under the speed limit Truck
was. Based on the result, calculate a speeding fine based on the following conditions:
The function should also perform string slicing on the SINGLE formatted string and
store the parts of that string as variables. Hint remember to omit any spaces or
commas If the driver was over the speed limit the function should print out a formatted
string: "First name Last name, Driver's license number: XXXXX was over the speed
limit by They have been fined $dots." Otherwise, the function should print out
"First name Last name, Driver's license number: XXXXX was not speeding!"
Hint:
In order to extract information from the formatted string, you need to make use of the
find method, focusing on the commas.
Your final output should be contained in one single print statement, on one line.
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