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


Groups > comp.lang.python > #89667

Re: Rounding a number

From Thijs Engels <thijs@buckazoids.com>
Subject Re: Rounding a number
Date 2015-04-30 22:00 +0200
References <du05kahu2bla717q2b09fc2p0foou7odcd@4ax.com>
Newsgroups comp.lang.python
Message-ID <mailman.144.1430424020.3680.python-list@python.org> (permalink)

Show all headers | View raw


round(65253, -3)

might be what you are looking for...


On Thu, Apr 30, 2015, at 21:49, Seymore4Head wrote:
> 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))
> -- 
> https://mail.python.org/mailman/listinfo/python-list

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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