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? 
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))))

Thanks in advance 5 3921
Use the list's reverse() function. The only thing to keep in mind is
that it will reverse inplace.
Here is an example:

In [1]: l=[1,2,3]
In [2]: l.reverse()
In [3]: l
Out[3]: [3, 2, 1]

So you could accumulate your results in a list then apply reverse() on
it.
Hope this helps,
Nick Vatamaniuc
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?

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))))

Thanks in advance
Something like this? 
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

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?

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))))

Thanks in advance
"frankie_85" <st******@gmail.comwrites:
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
As was pointed out before, your assignment requires you to use a
list. You're using completely distinct names instead of storing these
sequences in a container. Read your course notes again, paying
attention to "containers" and especially "lists".

\ "For of those to whom much is given, much is required."  
`\ John F. Kennedy 
_o__) 
Ben Finney
If you wanted to keep the original list intact, you could do... 
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)

On Oct 29, 4:23 pm, "Murali" <gmkrishn.u...@gmail.comwrote:
Something like this?

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

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?

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))))

Thanks in advance
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
You can use extended slice operators http://www.python.org/doc/2.3.5/what...onslices.html [1]
This function call should do what yo expect
print [e, d, c, b, a][::1]
[1] Does anyone know where to find a comprehensible description of
enhanced slices in the Python docs besides an an aged "What's new?"
column? Or is it intended that newbies read this http://docs.python.org/ref/slicings.html ? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Raymond Hettinger 
last post by:
Here is a discussion draft of a potential PEP.
The ideas grew out of the discussion on pep284.
Comments are invited. Dart throwing is optional.
Raymond Hettinger
...

by: Raymond Hettinger 
last post by:
Please comment on the new PEP for reverse iteration methods.
Basically, the idea looks like this:
for i in xrange(10).iter_backwards(): # 9,8,7,6,5,4,3,2,1,0
<do something with i>
The...

by: Raymond Hettinger 
last post by:
Based on your extensive feedback, PEP 322 has been completely revised.
The response was strongly positive, but almost everyone preferred
having a function instead of multiple object methods. The...

by: Raymond Hettinger 
last post by:
Based on the feedback here on comp.lang.python, the pep has been
updated:
www.python.org/peps/pep0322.html
The key changes are:
* reversed() is being preferred to ireverse() as the best...

by: rh0dium 
last post by:
Hi all,
I have a dict which looks like this..
dict={'130nm': {'umc': },
'180nm': {'chartered': , 'tsmc':
},
'250nm': {'umc': , 'tsmc':
}
}

by: rick 
last post by:
Why can't Python have a reverse() function/method like Ruby?
Python:
x = 'a_string'
# Reverse the string
print x
Ruby:
x = 'a_string'
# Reverse the string

by: sunnyluthra1 
last post by:
Hi,
I was creating an Application in MS Access for Geocoding a particular Address from Google to get the Lat & Long.
I successfully able to did that.
Here is the code:...

by: Alex Snast 
last post by:
Hello
I'm new to python and i can't figure out how to write a reverse for
loop in python
e.g. the python equivalent to the c++ loop
for (i = 10; i >= 0; i)

by: Chris Rebert 
last post by:
On Thu, Oct 2, 2008 at 8:07 PM, David Di Biase <dave.dibiase@gmail.comwrote:
Rather than defining a comparison function here (which is less
efficient), you can use the 'key' argument, which...

by: Naresh1 
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...

by: antdb 
last post by:
Ⅰ. Advantage of AntDB: hyperconvergence + streaming processing engine
In the overall architecture, a new "hyperconvergence" concept was proposed, which integrated multiple engines and...

by: Matthew3360 
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
header("Location:".$urlback);
Is this the right layout the...

by: Matthew3360 
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...

by: Arjunsri 
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...

by: Matthew3360 
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...

by: Carina712 
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...

by: BLUEPANDA 
last post by:
At BluePanda Dev, we're passionate about building highquality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...

by: Rahul1995seven 
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
 