Question: Problem 1 Python on pycharm Use the code below to create a function. Call the function storeDiscount. We want to automate the process. So ,
Problem Python on pycharm
Use the code below to create a function. Call the function storeDiscount. We want to automate the process. So call the function and inside the function prompt the user for the input on A B and C Most likely, if this was a piece of code for a store, the inputs would be entered into the function storeDiscount as parameters. We would already know how many A B and C the customer bchish. You can create the function either way.
# A store will give a discount of if the purchase is above $
# item A costs $ is $ is $
# ask the user how many of each is purchased
# then calculate the discount if any and the total amount due.
# We need three input statements and we'll need these to be integers
# we need three variables to match A B C
# need a variable for discount and total amount purchased
numA intinputHow many of A did you purchase?
numB intinputHow many of B did you purchase?
numC intinputHow many of C did you purchase?
initialcost numA numB numC
if initialcost :
discount initialcost
finalbill initialcost discount
printThe discount is discount
else:
finalbill initialcost
printThere was no discount on your bill."
printThe total due is finalbill
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
