Re: Lists and Decimal numbers

2013-03-20 Thread Alister
On Wed, 20 Mar 2013 20:00:38 +, Grant Edwards wrote: > On 2013-03-20, Alister wrote: > >> and a list comprehension would streamline things further >> >> t=[round(x*1.0/60),4 for x in range(1440)] #compatible with V2.7 & >> V3.0) > > There's a typo in the above. It should be: > > t = [rou

Re: Lists and Decimal numbers

2013-03-20 Thread Grant Edwards
On 2013-03-20, Alister wrote: > and a list comprehension would streamline things further > > t=[round(x*1.0/60),4 for x in range(1440)] #compatible with V2.7 & V3.0) There's a typo in the above. It should be: t = [round((x*1.0/60),4) for x in range(1440)] -- Grant Edwards gran

Re: Lists and Decimal numbers

2013-03-20 Thread Mark Lawrence
On 20/03/2013 19:20, Alister wrote: On Wed, 20 Mar 2013 16:52:00 +0100, Peter Otten wrote: Ana Dionísio wrote: 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]) In many cases you

Re: Lists and Decimal numbers

2013-03-20 Thread Alister
On Wed, 20 Mar 2013 16:52:00 +0100, Peter Otten wrote: > Ana Dionísio wrote: > >> 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]) > > In many cases you can write > >

Re: Lists and Decimal numbers

2013-03-20 Thread Peter Otten
Ana Dionísio wrote: > 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]) In many cases you can write for i in range(...): ... instead of incrementing manually. >

Re: Lists and Decimal numbers

2013-03-20 Thread Wanderer
On Wednesday, March 20, 2013 11:27:30 AM UTC-4, Ana Dionísio wrote: > 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 doi

Lists and Decimal numbers

2013-03-20 Thread Ana Dionísio
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