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


Groups > comp.lang.python > #41603

Lists and Decimal numbers

X-Received by 10.224.72.199 with SMTP id n7mr3682294qaj.5.1363793250677; Wed, 20 Mar 2013 08:27:30 -0700 (PDT)
X-Received by 10.49.84.73 with SMTP id w9mr627804qey.34.1363793250323; Wed, 20 Mar 2013 08:27:30 -0700 (PDT)
Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!dd2no3781324qab.0!news-out.google.com!k8ni4137qas.0!nntp.google.com!dd2no3781320qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Wed, 20 Mar 2013 08:27:30 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=95.92.175.80; posting-account=37ULnAoAAABw71rR4ndGDrmbiRWlgXUJ
NNTP-Posting-Host 95.92.175.80
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <9d8e4386-e6f5-4303-8a6a-be2a16e45ce7@googlegroups.com> (permalink)
Subject Lists and Decimal numbers
From Ana DionĂ­sio <anadionisio257@gmail.com>
Injection-Date Wed, 20 Mar 2013 15:27:30 +0000
Content-Type text/plain; charset=ISO-8859-1
X-Received-Bytes 1463
Xref csiph.com comp.lang.python:41603

Show key headers only | View raw


So, I have this script that puts in a list every minute in 24 hours

hour=[]
i=0
t=-(1.0/60.0)
while i<24*60:
    i = i+1
    t = t+(1.0/60.0)
    hour.append([t])

When it is doing the cicle it can have all the decimal numbers, but I need to print the result with only 4 decimal numbers

How can I define the number of decimal numbers I want to print in this case? For example with 4 decimal numbers, it would print:

0.0000
0.0167
0.0333
...

Can you help?

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


Thread

Lists and Decimal numbers Ana DionĂ­sio <anadionisio257@gmail.com> - 2013-03-20 08:27 -0700
  Re: Lists and Decimal numbers Wanderer <wanderer@dialup4less.com> - 2013-03-20 08:48 -0700
  Re: Lists and Decimal numbers Peter Otten <__peter__@web.de> - 2013-03-20 16:52 +0100
    Re: Lists and Decimal numbers Alister <alister.ware@ntlworld.com> - 2013-03-20 19:20 +0000
      Re: Lists and Decimal numbers Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-20 19:53 +0000
      Re: Lists and Decimal numbers Grant Edwards <invalid@invalid.invalid> - 2013-03-20 20:00 +0000
        Re: Lists and Decimal numbers Alister <alister.ware@ntlworld.com> - 2013-03-20 20:47 +0000

csiph-web