Question: Write a Python function that takes two parameters: distance ( in kilometres ) and weight ( in kilograms ) . The function should calculate and
Write a Python function that takes two parameters: distance in kilometres and weight in kilograms The function should calculate and return the shipping cost based on the following criteria:
For distances less than or equal to kilometres, the shipping cost is RO per kilogram.
For distances greater than kilometres, the shipping cost is RO per kilogram.
Write a main function to test the defined function by prompting the user to input the distance. Then, randomly generate the weight of the package between and kg Finally, call the defined function above with these inputs and print the total shipping cost.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
