Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #89666

Rounding a number

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news.astraweb.com!border5.newsrouter.astraweb.com!not-for-mail
From Seymore4Head <Seymore4Head@Hotmail.invalid>
Newsgroups comp.lang.python
Subject Rounding a number
Date Thu, 30 Apr 2015 15:49:52 -0400
Message-ID <du05kahu2bla717q2b09fc2p0foou7odcd@4ax.com> (permalink)
X-Newsreader Forte Agent 4.2/32.1118
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Lines 12
Organization Unlimited download news at news.astraweb.com
NNTP-Posting-Host 49d344f9.news.astraweb.com
X-Trace DXC=kGkIC`KHV37l=bkA3Hk5C1L?0kYOcDh@:U^I3MRbi=k1S2kSQZD<P_;l9B_G1R=S=7<>a^elBcbL94C2lP`1;c66<nQ40Z[`bH1ZZa>Z:]KAi8
Xref csiph.com comp.lang.python:89666

Show key headers only | View raw


I have this page book marked.
https://mkaz.com/2012/10/10/python-string-format/

I am getting numbers from sixty thousand to two hundred thousand.
I would like to round them to the nearest thousand.
So 65,253 should read 65,000.
How?

Total=2100
for x in range (10,35):
    count=1000/x
    print ("Foo {:7,.0f} Fighters".format(Total*count))

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Rounding a number Seymore4Head <Seymore4Head@Hotmail.invalid> - 2015-04-30 15:49 -0400
  Re: Rounding a number Thijs Engels <thijs@buckazoids.com> - 2015-04-30 22:00 +0200
    Re: Rounding a number Seymore4Head <Seymore4Head@Hotmail.invalid> - 2015-04-30 18:35 -0400
      Re: Rounding a number Dave Angel <davea@davea.name> - 2015-04-30 18:58 -0400
  Re: Rounding a number Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-04-30 21:08 +0100
  Re: Rounding a number Tony the Tiger <tony@tiger.invalid> - 2015-05-02 21:34 +0000

csiph-web