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_bonus that accepts a single numerical argument: a sales

image text in transcribed

use python IDLE when providing your solution and answer everything above

1. Compose a function called calc_bonus that accepts a single numerical argument: a sales amount. This argument should be a positive number. If the argument is not valid, the output of the function is undefined. This function should return the bonus awarded based on the sales amount using the following logic: If the sales amount is greater than $10,000, then the bonus about is 5% of the sales amount. Otherwise, the bonus amount is only 2% of the sales amount. For example, \( \begin{array}{ll}\text { calc_bonus (15000) } & \text { \# output: } 750 \\ \text { calc_bonus (7000) } & \text { \# output: 210 } \\ \text { calc_bonus (-10) } & \text { \# output: undefined }\end{array} \) 2. Compose a function called temp_feel that accepts a single numerical argument: a temperature. This argument should be a floating point number. This function should return a string based upon the input temperature, determined using the following logic: if the temperature is less than 40, return COLD, if it is between 40 and 60 (inclusive), return CHILLY, and if it is greater than 60, return NICE. For example, \( \begin{array}{ll}\text { temp_feel }(0) & \# \text { output: COLD } \\ \text { temp_feel }(100) & \# \text { output: NICE } \\ \text { temp_feel }(60) & \text { \# output: CHILLY }\end{array} \) 3. Compose a function called floor_division that accepts two numerical arguments. It should return an integer, calculated by dividing the first argument by the second. If the division is not defined, the output of the function is undefined, but the function must not throw an error. For example, floor_division (5,2) \# output: 2 floor_division (100,20) \# output: 5

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