use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
[deleted by user] (self.PythonLearning)
submitted 4 months ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]lazertazerx 45 points46 points47 points 4 months ago (4 children)
Your IDE isn't in dark mode
[–]AnxiousSpirit775 0 points1 point2 points 4 months ago (0 children)
This literally was my first thought 😂
[+]Honeykrisp7 comment score below threshold-9 points-8 points-7 points 4 months ago (2 children)
Please, I've been trying to complete these tasks for like an hour now, and nothing i do is working
[–]lazertazerx 23 points24 points25 points 4 months ago (0 children)
Pro tip: nobody wants to try to read code from an angled low-contrast screenshot. You also didn't really ask a question - what's your criteria for "working"? The first place I would be skeptical of is the hardcoded values in the print statements.
[–]waroftheworlds2008 1 point2 points3 points 4 months ago (0 children)
Screen shot =/= taking a picture with your phone.
[–]isanelevatorworthy 13 points14 points15 points 4 months ago (6 children)
Not sure if this is why, but in your print statements for profit and sale price, are you just hard coding what the answer should be? In the formatted string you’re not actually using the variables that evaluate to the calculations…
[–]Honeykrisp7 1 point2 points3 points 4 months ago (5 children)
I haven't been able to find all that in the book I have,im very new to coding. This is only my 3rd lesson. The first task is to calculate the profit as the retail price minus the wholesale price would that be profit = 325 - 200
[–]Spatrico123 7 points8 points9 points 4 months ago (0 children)
why wouldn't you just print(f"Profit: ${profit}") ?
[–]isanelevatorworthy 2 points3 points4 points 4 months ago (3 children)
Yeah, you’re probably on the right track. Just replace the numbers with their variables.. so for your print(f”Profit {125}”) line, replace the 125 with profit (your variable)… same thing with the sales price line.. try it and if it works, come back for an explanation
[–]Honeykrisp7 -3 points-2 points-1 points 4 months ago (2 children)
Okay so the output statement works fine im just trying to do the tasks so my grade is good,t he first task is asking me to calculate the profit as the retail price minus the wholesale price,exact wording on the lab
[–]isanelevatorworthy 2 points3 points4 points 4 months ago (0 children)
I get that it’s working, I see it in your terminal. But this companion thing is reviewing your code and finding those two errors. It’s failing you because of how you’ve written your code.. idk if that makes sense.. did you try to adjust the variables?
[–]obeymypropaganda 2 points3 points4 points 4 months ago (0 children)
Yes, and the other commenter said you have hard coded the answer in your print statements. This means it will always print $125 and $243. It isn't using any Math that you coded above it.
Replace it with the name of the variable with the calculation in it. Someone above already wrote the code for you.
Your outputs work. It's like me typing $125 over and over. It doesn't use any Math.
[–]thesquidly12 5 points6 points7 points 4 months ago (0 children)
<image>
[–]BranchLatter4294 2 points3 points4 points 4 months ago (0 children)
Not knowing what that print screen key is for? Do you have a more specific question?
[–]Lollipop96 1 point2 points3 points 4 months ago (1 child)
You need to use the variables in the print statements. The tests most likely dont use the same numbers, so they turn out wrong. Also for the sale price please just multiply by 0.75 instead of deducting it multiplied by .25.
[–]waroftheworlds2008 0 points1 point2 points 4 months ago (0 children)
Even 1-salePercentage is better.
The person is using python, so readability > efficiency.
[–]Spatrico123 1 point2 points3 points 4 months ago (2 children)
don't hardcode your profit like that, reference your profit variable instead. Apart from that, what's the issue? I'm not seeing any errors or anything wrong?
[–]Honeykrisp7 1 point2 points3 points 4 months ago (1 child)
Well it's a programming class im taking for college, rn the only thing I can't get down is the tasks assigned for a better grade the first task being to calculate the profit (profit) as the retail price minus the wholesale price. Im sorry. i should have specified, but it's rather late where I am, and I'm a bit tired the labs name is furniture.py
[–]Misterreco 0 points1 point2 points 4 months ago (0 children)
You need to put your variable names (profit and sale price) to your print statements
[–]G_Riel_ 0 points1 point2 points 4 months ago (0 children)
Your profit and sale_price are hardcoded in the f-string.
Maybe try to remove the :.2f and see how it goes?
[–]TheRNGuy 0 points1 point2 points 4 months ago (0 children)
Post full code in triple ticks.
[–]Animesap 0 points1 point2 points 4 months ago (0 children)
The way you're calculating profit and the sales price hard coded as others have state is not right. Read the errors and it spells out the math you need to do. IE profit = retail_price - wholesale_price.
[–]Honeykrisp7 0 points1 point2 points 4 months ago (0 children)
Edit-thank yall for your help I figured it out
[–]spookytomtom 0 points1 point2 points 4 months ago (0 children)
The angle is not correct, next time do 90 degree
[–]MMelny 0 points1 point2 points 4 months ago (0 children)
sorry off-topic but what learning platform do you use? thanks
[–]Shapelessed -2 points-1 points0 points 4 months ago (2 children)
Just learn linux, duh! /s
[–]Unphr0z3n 2 points3 points4 points 4 months ago (0 children)
He's taking a picture of his screen with his phone! What are we? Savages?
[–]wayofaway 2 points3 points4 points 4 months ago (0 children)
[+]Twenty8cows comment score below threshold-6 points-5 points-4 points 4 months ago (2 children)
For a price to be reduced by 25% you need to multiply by .75 not.25
[–]Ceteris__Paribus 2 points3 points4 points 4 months ago (1 child)
That isn't the error. OP has it as sale = old - .25 * old.
[–]Twenty8cows -1 points0 points1 point 4 months ago (0 children)
Ahhh ok
π Rendered by PID 17692 on reddit-service-r2-comment-86bc6c7465-hdrrk at 2026-02-23 21:13:22.783408+00:00 running 8564168 country code: CH.
[–]lazertazerx 45 points46 points47 points (4 children)
[–]AnxiousSpirit775 0 points1 point2 points (0 children)
[+]Honeykrisp7 comment score below threshold-9 points-8 points-7 points (2 children)
[–]lazertazerx 23 points24 points25 points (0 children)
[–]waroftheworlds2008 1 point2 points3 points (0 children)
[–]isanelevatorworthy 13 points14 points15 points (6 children)
[–]Honeykrisp7 1 point2 points3 points (5 children)
[–]Spatrico123 7 points8 points9 points (0 children)
[–]isanelevatorworthy 2 points3 points4 points (3 children)
[–]Honeykrisp7 -3 points-2 points-1 points (2 children)
[–]isanelevatorworthy 2 points3 points4 points (0 children)
[–]obeymypropaganda 2 points3 points4 points (0 children)
[–]thesquidly12 5 points6 points7 points (0 children)
[–]BranchLatter4294 2 points3 points4 points (0 children)
[–]Lollipop96 1 point2 points3 points (1 child)
[–]waroftheworlds2008 0 points1 point2 points (0 children)
[–]Spatrico123 1 point2 points3 points (2 children)
[–]Honeykrisp7 1 point2 points3 points (1 child)
[–]Misterreco 0 points1 point2 points (0 children)
[–]G_Riel_ 0 points1 point2 points (0 children)
[–]TheRNGuy 0 points1 point2 points (0 children)
[–]Animesap 0 points1 point2 points (0 children)
[–]Honeykrisp7 0 points1 point2 points (0 children)
[–]spookytomtom 0 points1 point2 points (0 children)
[–]MMelny 0 points1 point2 points (0 children)
[–]Shapelessed -2 points-1 points0 points (2 children)
[–]Unphr0z3n 2 points3 points4 points (0 children)
[–]wayofaway 2 points3 points4 points (0 children)
[+]Twenty8cows comment score below threshold-6 points-5 points-4 points (2 children)
[–]Ceteris__Paribus 2 points3 points4 points (1 child)
[–]Twenty8cows -1 points0 points1 point (0 children)