Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSHAWNELL HARRISON
16,282 PointsCan someone help me please?
Can some help me with the problem below.
Thanks
Design the logic that will use assignment statements to: Calculate the profit (profit) as the retail price minus the wholesale price Calculate the sale price (salePrice) as 25 percent deducted from the retail price Calculate the profit when the sale price is used (saleProfit) as the sale price minus the wholesale price
itemName = "TV Stand"
retailPrice = 325.00
wholesalePrice = 200.00
profit-wholesale
# Write your assignment statements here for profit, salePrice, and saleProfit
print("Item Name: " + itemName)
print("Retail Price: $" + str(retailPrice))
print("Wholesale Price: $" + str(wholesalePrice))
print("Profit: $" + str(profit))
print("Sale Price: $" + str(salePrice))
print("Sale Profit: $" + str(saleProfit))
Mod Edit: Fixed code formatting. You can use markup to give your code fancy formatting. Try editing your post to see how!
sandis
10,738 Pointsprofit is not defined
1 Answer
Steven Parker
231,275 PointsThis code seems to be only "print" statements and is missing the calculations and variable assignments. In particular:
- profit, salePrice, and saleProfit have not been defined
- an expression (like "
profit-wholesale
") doesn't do anything by itself (assign it to a variable)
Steven Parker
231,275 PointsSteven Parker
231,275 PointsIs this for a challenge? The link button at the top of the page leads to a video.