It was flagged as duplicate even though it hasn't been asked before just because some aspect of it is basic (round decimals).
No, that's literally the entire question—how do I print this floating-point value with only 3 decimal places? Basic questions like that are fine on Stack Overflow, but they're usually duplicates, and this one is no exception.
But the question is more complicated than it looks because I don't want to lose the actual value of the coefficient, just print a shorter version of it.
The solutions to the duplicate question will do precisely that. The print
command is not destructive: it will not and cannot change your original value.
It was suggested in the comments that you try this solution. If you'd tried it, you'd see that it would work for you. Clearly, you have not tried it.
If you have tried it, and still can't get it to work or still can't figure out how to apply the solutions given in the proposed duplicate(s), then you should edit your question and include updates on what you've tried and why it isn't working for you. That would make your question no longer a duplicate, and thus eligible to be re-opened. See also: "This question already has answers here" - but it does not. What can I do when I think my question's not a duplicate?
It is extremely disappointing that this community is so unwelcoming to new people and that someone can just unilaterally decide it isn't a good enough question because they know how to do it already or can interpret slightly related solutions easily.
Come now, don't exaggerate. Almost nothing you say here is true:
- It isn't "unwelcoming to new people" to mark someone's question as a duplicate—giving you a link to a high-quality Q&A with answers that have been vetted over years is both helpful and welcoming.
- Nor was the decision to mark your question as a duplicate "unilateral", as you claim: there were two different people who voted to close the question, one an expert in Python and the other (myself) a site moderator.
- Furthermore, no one ever said your question wasn't "good enough"—we merely said it was a duplicate, which is an objective fact.
- Questions are never closed because the voters "know how to do it already".
because I don't want to lose the actual value of the coefficient, just print a shorter version of it
The first duplicate gives the answer to that.