Answer:
# price of the carpet per square foot for each quality.
carpet_prices=[1,2,4]
def cal_cost(width,height,choice):
return width*height*carpet_prices[choice-1]
width=int(input("Enter Width : "))
height=int(input("Enter Height : "))
print("---Select Carpet Quality---")
print("1. Standard Quality")
print("2. Primium Quality")
print("3. Premium Plus Quality")
choice=int(input("Enter your choice : "))
print(f"Carpeting cost = {cal_cost(width,height,choice)}")
Explanation:
The cal_cost function is used to return the cost of carpeting. The function accepts three arguments, width, height, and the choice of carpet quality.
The program gets the values of the width, height and choice, calls the cal_cost function, and prints out the string format of the total carpeting cost.