On 25/03/2011 13:15, clodemil wrote:
Hi all,
Here is a list:
mesures=[[172,91,57],[181,88,58],[146,88,56],[191,85,59],[171,92,50],
[157,93,55],[180,84,48],[142,77,60],[169,80,45],[162,76,59],
[167,104,73],[166,81,53],[145,78,59],[163,98,58],[192,90,50],
[184,85,60],[151,77,56]]
# [[P systolic,P diastolic,Pulse rate]]
and a function
There's at least two ways of modifying this. You could either append to
a list as you go along:
def Ppulse(mesures):
results=[]
#Why are you using enumerate here, as you don't use k?
for k,l in enumerate(mesures):
result.append(N((l[0]-l[1]),12))
print N((l[0]-l[1]),12)
# Pulse Pressure = Psys - Pdia
Or, a more Pythonic way of doing this would be with a list comprehension:
def Pulse(measures): return [N((l[0]-l[1]),12) for l in measures]
I hope this helps
Alastair
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org