Lovely loveseat can't perform addition

https://www.codecademy.com/courses/learn-python-3/projects/python-furniture-store

i’ve watched the video matched the code it will not do the math or render the description, i get no errors and have gone through the code multiple times, what am i missing?

lovely_loveseat_description = "Lovely Loveseat. Tufted polyester blend on wood. 32 inches high x 40 inches wide x 30 inches deep. Red or white.\n"

lovely_loveseat_price = '254.00'


stylish_settee_description = "Stylish Settee. Faux leather on birch. 29.50 inches high x 54.75 inches wide x 28 inches deep. Black"
stylish_settee_price = '180.50'
luxurious_lamp_descrption = "Luxurious Lamp. Glass and iron. 36 inches tall. Brown with cream shade."
luxurious_lamp_price = '52.15'
sales_tax = '0.888'
customer_one_total = '0'
customer_one_itemization = ""
customer_one_total += 'lovely_loveseat_price'
customer_one_itemization += "lovely_loveseat_description"
customer_one_total +='luxurious_lamp_price'
customer_one_itemization +="luxurious_lamp_description"
customer_one_tax = ('customer_one_total * Sales_tax')
customer_one_total += 'customer_one_tax' 
print('Customer one items:')
print("customer_one_itemization")
print('Customer one total')
print('customer_one_total')

Is that a variable or a string?

1 Like

Pretty sure it’s a string it’s the addition of the items purchases

You should have another look at the instructions and review your code step-by-step.

Here are a few issues with the code you have have posted:

  • Strings are meant to be assigned to the variables lovely_loveseat_description (and other variables holding the description). You have done that. But, strings are not meant to be assigned to the variables such as lovely_loveseat_price (and the other variables involving price). Instead they should be assigned numbers. The instructions do not mention that the prices are meant to be stored as strings.
// You wrote:
lovely_loveseat_price = '254.00'

// It should be:
lovely_loveseat_price = 254.00

// Same issue with the variables stylish_settee_price, luxurious_lamp_price,
// sales_tax, customer_one_total, customer_one_tax
  • A sales tax of 0.888 or 88.8% doesn’t seem correct. Re-visit the step where the tax is mentioned.

  • If you want to add the price of an item to the total, then

// Incorrect
customer_one_total += 'lovely_loveseat_price'

// Correct
customer_one_total += lovely_loveseat_price
  • If you want to update the itemization string, then
// Incorrect
customer_one_itemization += "lovely_loveseat_description"

// Correct
customer_one_itemization += lovely_loveseat_description

lovely_loveseat_description is the name of the variable. The value assigned to this variable is meant to be a string i.e. "Lovely Loveseat. Tufted...", but the name of the variable can’t be a string.

customer_one_itemization = ""

# Incorrect
customer_one_itemization += "lovely_loveseat_description"

# is equivalent to:
# customer_one_itemization = "" + "lovely_loveseat_description"
# customer_one_itemization =  "lovely_loveseat_description"

# Correct
customer_one_itemization += lovely_loveseat_description

# is equivalent to:
# customer_one_itemization = "" + "Lovely Loveseat. Tufted..."
# customer_one_itemization =  "Lovely Loveseat. Tufted..."

We want to concatenate the string assigned to the variable lovely_loveseat_description. We don’t want to concatenate the name of the variable.

  • This is also incorrect:
customer_one_tax = ('customer_one_total * Sales_tax')

// Should be:
customer_one_tax = (customer_one_total * sales_tax)
  • As mentioned by mtf,
// You wrote:
print('Customer one items:')
print("customer_one_itemization")

// It should be:
print('Customer one items:')    // We want to print the string 
print(customer_one_itemization) // We want to print the value assigned to variable

print('customer_one_itemization')
// would print the string
"customer_one_itemization"

print(customer_one_itemization)
// would print the value assigned to this variable
"Lovely Loveseat. Tufted.."
2 Likes

Love ow detailed and clear this explanation is, I aspire to get to this level one day.

yes i went back and just retyped everything and paid more close attention to the syntax errors and i got it to fully work yesterday, however I greatly appreciate your detailed explanation it has helped me figure out where i keep going wrong it is all the ",',: and other parts to make strings variables and such.
thank you so much

1 Like

lovely_loveseat_description = “Lovely Loveseat. Tufted polyester blend on wood. 32 inches high x 40 inches wide x 30 inches deep. Red or white.”

lovely_loveseat_price = 254.00

stylish_settee_description = “Stylish Settee. Faux leather on birch. 29.50 inches high x 54.75 inches wide x 28 inches deep. Black.”

stylish_settee_price = 180.50

luxurious_lamp_description = “Luxurious Lamp. Glass and iron. 36 inches tall. Brown with cream shade.”

luxurious_lamp_price = 52.15

sales_tax = .088

customer_one_total = 0

customer_one_itemization = “”

customer_one_total += lovely_loveseat_price

customer_one_itemization += lovely_loveseat_description

customer_one_total += luxurious_lamp_price

customer_one_itemization += luxurious_lamp_description

customer_one_tax = customer_one_total * sales_tax

customer_one_total += customer_one_tax

print(“Customer One Items:”)

print(customer_one_itemization)

print(“Customer One Total:”)

print(customer_one_total)

If it checks wrong all you need to do is retype the quoation marks.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.