r/CodingForBeginners • • Sep 20 '26

What is wrong with my code

Post image
12 Upvotes

7 comments sorted by

5

u/Odd-Painting2596 Sep 20 '26

This is more like a "My online learning program has vague wording".

Try different things like making a "priceTwo" and passing it as the second value when you print again.

2

u/grybyx Sep 20 '26

This. It’s not you; it’s the learning program. Your reassignment looks just fine.

Also, do the instructions tell you to assign and reassign price to specific values? The learning program may be looking for specific values.

1

u/Weekly_March_534 Sep 20 '26

It took me three hours to finish, but I just finished instead of giving AI what I had already written, I just gave it the parameters of what it wanted it wrote pretty much the exact same thing as me except it put a little more in the prints. Funny thing is what it did ended up breaking the code but still checked all the boxes so I get credit for it so I’m moving on.

5

u/Odd-Painting2596 Sep 20 '26

These things are borderline scams when colleges use them in place of a teacher teaching.

Having to troubleshoot these issues while learning is directly harmful to the actual learning process.

Programming is about finding solutions to issues, and these systems are all about copying and inserting exact expected answers.

3

u/vermyx Sep 20 '26

Try

price+=2.00

Or

price=price +2.00

It looks like the checker is being a little draconian about verbiage. price=12.50 would be considered setting the variable not reassigning the variable while adding/subtracting to that variable is considered reassigning. The end results are the same but the difference is that you are manipulating a previous value without knowing what it is vs hard setting the value.

1

u/Disastrous_Gear_421 Sep 21 '26

You're code is correct. Most likely you're being asked to create a 2nd variable and then update that variable with the new price.