Study Guide

3.6.7 Sporting Goods Shop CodeHS Answers

3.6.7 Sporting Goods Shop CodeHS Answers

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:

  1. Defines a constant COST_OF_FRISBEES representing the cost of a single frisbee.
  2. Asks the user for the number of frisbees they wish to purchase and stores this number in the amount variable.
  3. Calculates the total cost by multiplying the COST_OF_FRISBEES by the amount.
  4. Prints the total cost in a formatted message to the user.