Round to 2 decimal places

Steve D'Aprano steve+python at pearwood.info
Wed Dec 6 22:29:51 EST 2017


On Thu, 7 Dec 2017 01:31 pm, nick martinez wrote:

> interesting, what version of python are you using? Tried it multiple times
> and it still isn't working.


Please launch a terminal window, copy this command exactly into the terminal
and hit ENTER. You should have a $ or maybe % prompt for this to work.

python3.5 -c "volume = 257.148345678; print(round(volume, 2))"

(Do you need help opening a terminal window? If so, ask. We'll need to know
your operating system, and if you are using Linux, which desktop environment
you are using.)

If your prompt is ">>>" (without the quotes) or something similar to "In [1]:"
then copy these two lines to the prompt and hit ENTER:

volume = 257.148345678
print(round(volume, 2))

Either way, reply here with the output. Make sure you copy it.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list