Question: I have written a code for this but I cannot get the money_spent to be multiplied by this discount def coupon(money_spent): Return coupon based

I have written a code for this but I cannot get theI have written a code for this but I cannot get the money_spent to be multiplied by this discount

def coupon(money_spent): """ Return coupon based on amount spent coupon == =10 but 60 but 150 but 210 there is a 14 percent coupon used """ if money_spent >10: return (money_spent) elif money_spent >=10 and money_spent 60 and money_spent 150 and money_spent 210: return (money_spent*0.14)

print(coupon(9)) print(coupon(30)) print(coupon(90)) print(coupon(180)) print(coupon(240))

Please solve my problem for me

Exercise 2 (Based on an exercise by Cay Horstmann and Rance Necaise) A supermarket awards coupons depending on how much a customer spends on groceries. For example, if you spend $50, you'll get a coupon worth 8% of that amount ( $4). The following table shows the percentage used to calculate the coupon awarded for different amounts spent: Use the function design recipe (examples, header, description, body, test) to develop a function named coupon. The function has one parameter, which is the amount spent on groceries. Use a descriptive name. The function returns the value of the coupon. Your function definition must have type annotations and a complete docstring (a brief description of what the function does, any preconditions, and two or three examples showing how to use the shell to test the functions). Type the function definition below the comment, \# Exercise 2. Use the Python shell to test coupon

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!