Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use python IDLE when providing your solution and answer everything above 1. Compose a function called calc_final_price that accepts two numerical arguments: the original price

image text in transcribed

use python IDLE when providing your solution and answer everything above

1. Compose a function called calc_final_price that accepts two numerical arguments: the original price of an item, and the tax rate applied to that item. The original price must be a floating point number that is greater than 0 , and the tax rate must be an integer on the interval [0, 100] (e.g., a tax rate of 6 corresponds to a 6% tax rate, etc.). If the provided arguments do not fall in these ranges, the output of the function is undefined (i.e., no need to error check--whatever happens, happens). The function should return the final price of the item after accounting for taxes (initial price + taxes). A few examples: calc_final_price (35,8)# output: 37.8 calc_final_price (150,0)# output: 150 calc_final_price (0,9)# output: undefined (can be anything) calc_final_price(-15, 12) \# output: undefined (can be anything) calc_final_price (1500,107) \# output: undefined (can be anything) 2. Compose a function called calc_disc_price that accepts two numerical arguments: the original price of an item, and a discount rate. The original price must be a floating point number that is greater than 0 , and the discount rate must be an integer on the interval [0,100] (e.g., a discount rate of 25 corresponds to a 25% discount). If the provided arguments do not fall within these ranges, the output of the function is undefined. The function should return the final price of the item after applying the discount (initial price - discount). A few examples: \( \begin{array}{ll}\text { calc_disc_price }(250,25) & \# \text { output: } 187.5 \\ \text { calc_disc_price }(1000,100) & \# \text { output: } 0 \\ \text { calc_disc_price }(123,0) & \# \text { output: } 123 \\ \text { calc_disc_price }(0,25) & \text { \# output: undefined (can be anything) }\end{array} \)

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

Compare and contrast monochronic and polychronic time orientations

Answered: 1 week ago

Question

2 The main characteristics of the market system.

Answered: 1 week ago