The most common answer is:
Enter your code here
COST_OF_FRISBEES = 15
amount = int(input(“How many Frisbees would you like to buy?”))
cost= (COST_OF_FRISBEES * amount)
print(“The cost for ” + str(amount) + ” frisbees is $” + str(cost) + ” dollars.”)
To ensure the program runs smoothly and adheres to proper Python syntax, including the use of standard ASCII quotation marks, here’s the corrected version of your code for a sporting goods shop that calculates the cost of purchasing frisbees:
COST_OF_FRISBEES = 15
amount = int(input("How many Frisbees would you like to buy? "))
cost = (COST_OF_FRISBEES * amount)
print("The cost for " + str(amount) + " frisbees is $" + str(cost) + " dollars.")
This program:
- Defines a constant
COST_OF_FRISBEES
representing the cost of a single frisbee. - Asks the user for the number of frisbees they wish to purchase and stores this number in the
amount
variable. - Calculates the total cost by multiplying the
COST_OF_FRISBEES
by theamount
. - Prints the total cost in a formatted message to the user.