If you wanted to keep the original list intact, you could do... [code] foo = [x1,x2,x3,x4,x5] bar = [math.sqrt(math.fabs(x))+5*math.pow(x,3) for x in foo] bar_reversed = reversed(bar) [/code]
On Oct 29, 4:23 pm, "Murali" <[EMAIL PROTECTED]> wrote: > Something like this? > > [code] > foo = [x1,x2,x3,x4,x5] > bar = [math.sqrt(math.fabs(x))+5*math.pow(x,3) for x in foo] > bar.reverse() > print bar > [/code] > > frankie_85 wrote: > > Ok I'm really lost (I'm new to python) how to use the reverse function. > > > I made a little program which basically the a, b, c, d, e which I have > > listed below and basically I want it th result to be printed reverse so > > instead doing "print e, d, c, b, a", I'd like to use the reverse > > function > > > Can someone give pointersguidelines / on how to do it? > > > [code] > > a = str(math.sqrt(math.fabs(x1)) + 5*((math.pow(x1,3)))) > > b = str(math.sqrt(math.fabs(x2)) + 5*((math.pow(x2,3)))) > > c = str(math.sqrt(math.fabs(x3)) + 5*((math.pow(x3,3)))) > > d = str(math.sqrt(math.fabs(x4)) + 5*((math.pow(x4,3)))) > > e = str(math.sqrt(math.fabs(x5)) + 5*((math.pow(x5,3)))) > > [/code] > > > Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list