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 1 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 20% if the purchase is above $100.
# item A costs $18.50B is $27.90C is $50
# 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
num_A = int(input("How many of A did you purchase? "))
num_B = int(input("How many of B did you purchase? "))
num_C = int(input("How many of C did you purchase? "))
initial_cost =18.50** num_A +27.90* num_B +50.00* num_C
if initial_cost >100:
discount =0.20** initial_cost
final_bill = initial_cost - discount
print("The discount is ", discount)
else:
final_bill = initial_cost
print("There was no discount on your bill.")
print("The total due is ", final_bill)
Problem 1 Python on pycharm Use the code below to

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 Programming Questions!