Help with "Lovely love seats" project in python "NameError: name ‘customer_one_tax’ is not defined"


#1

Project - https://www.codecademy.com/paths/computer-science/tracks/cspath-intro/modules/cspath-python-syntax/projects/furniture-store (lovely love seats)

So…I know im probably being reaaaaly dumb.

but im coming up with a
“NameError: name ‘customer_one_tax’ is not defined”
with this code and even after the video walk through i’m still confused on what im doing wrong with defining this varible >.<

Here’s the section of code this is associated with and the error is on line 1 with the customer_one_total

customer_one_total = lovely_loveseat_price + Luxurious_lamp_price + customer_one_tax 

customer_one_itemization += lovely_loveseat_description + Luxurious_lamp_description

customer_one_tax = customer_one_total * sales_tax

print("Customer one Items")
print(customer_one_itemization)
print("Customer one Total")
print(customer_one_total)

And here’s the error message that pops up in the console

Traceback (most recent call last):
File “script.py”, line 19, in
customer_one_total = lovely_loveseat_price + Luxurious_lamp_price + customer_one_tax
NameError: name ‘customer_one_tax’ is not defined

And im completely confused .-. any help would be greatly appreciated !

(I feel like I didnt make this topic the right way for some reason)


#2

here you “declare” (technically python variable are named) customer_one_tax:

customer_one_tax = customer_one_total * sales_tax

but before that, you already use customer_one_tax variable:

customer_one_total = lovely_loveseat_price + Luxurious_lamp_price + customer_one_tax

which at this point isn’t “defined” yet. which will give an error


#3

I actually forgot to update the topic, but instead of making and defining customer_one_tax, I just muliplied the sales_tax in the customer_one_total which didn’t produce an error message, but I’m curious

If I moved the customer_one_tax varible above the customer_one_total would that count it as defined? Because I tried that before but it then said that customer_one_total wasn’t defined because it wasn’t defined until the line below it

Also… I did do math wrong, somewhere, this morning I went back on the lesson and watched the video guide with the project (their formatting went way over my head :sweat_smile:), but my printed totals were different from theirs… and now I’m sorta racking my brain again with it because the only wrong thing I can think of is the sales tax not being calculated correctly but… I’m not sure, it seems doing it either way with customer_one_tax or not would produce the same result

Also sorry for the long letter of a post .-. and if it’s weird or hard to understand what I’m saying,I can reformat my code in this post when I’m able to get back to my computer in a few hours :slight_smile:


#4

i will wait for the reformat, please then also include the link to exercise.

i do not get notifications of edits, so a reply would be better