138k views
5 votes
{CHANCE TO EARN 75 POINTS}

Using Python, create a function for the cost to buy a car with the following arguments:

-Initial Price

-Sales Tax

Sales Tax is about 4.2% in Virginia, 7.3% in California, and 6.3% in Texas.

Find the cost of buying a car with an initial cost of $22,000 in Virginia.

Find the cost of buying a car with an initial cost of $30,000 in Texas.

Find the cost of buying a car with an initial cost of $50,000 in California.

1 Answer

6 votes

def getCarPrice(initialCost, salesTax):

return initialCost*(1+salesTax)

x = getCarPrice(22000, 0.042)

y = getCarPrice(30000, 0.063)

z = getCarPrice(50000, 0.073)

User Phydeauxman
by
8.6k points