I want to make a for loop in python to go over a list. However, I would like to have it going through the list in the opposite direction. For example    foo = [1a,2b,3c,4d]   for number in foo:       print number   the result of this code should be: 4d 3c 2b 1a and not 1a 2b 3c 4d.  Any elegant way to do this? Or is it best to reorder the initial list itself?  Many thanks for your advice
So I can start from len(collection) and end in collection[0].  I also want to be able to access the loop index.
Prove that $\sum^{n}_{r=0}(-1)^r\cdot \large\frac{\binom{n}{r}}{\binom{r+3}{r}} = \frac{3!}{2(n+3)}$ Prove that $\displaystyle \sum^{n}_{r=0}(-1)^r\cdot \large\frac{\binom{n}{r}}{\binom{r+3}{r}} = \frac{3!}{2(n+3)}$   $\bf{My\; Try::}$ We can write $$\frac{\binom{n}{r}}{\binom{r+3}{r}} = \frac{n!}{r!\times (n-r)!}\times \frac{r!\times 3!}{(r+3)!} = \frac{3!\times n!}{(n-r)!\times (r+3)!}$$  So our sum is $$ 3!\sum^{n}_{r=0}(-1)^r\frac{n!}{(n-r)!\times (r+3)!} = \frac{3!}{(n+1)(n+2)(n+3)}\sum^{n}_{r=0}(-1)^r\frac{(n+3)!}{(r+3)!\times (n-r)!}$$  So we get Sum $$ \frac{3!}{(n+1)(n+2)(n+3)}\sum^{n}_{r=0}(-1)^r\binom{n+3}{r+3} = -\frac{3!}{(n+1)(n+2)}\sum^{n}_{r=0}(-1)^{r+3}\binom{n+3}{r+3}$$  $$  = -\frac{3!}{(n+1)(n+2)(n+3)}\left[-\binom{n+3}{3}+\binom{n+3}{4}-\binom{n+3}{5}--.......+(-1)^{n+3}\binom{n+3}{n+3}\right]$$  $$=-\frac{3!}{(n+1)(n+2)(n+3)}\left[\binom{n+3}{0}-\binom{n+3}{1}+\binom{n+3}{2}-\binom{n+3}{3}+\binom{n+3}{4}-\binom{n+3}{5}--.......+(-1)^{n+3}\binom{n+3}{n+3}\right]+\frac{3!}{(n+1)(n+2)(n+3)}\left[\binom{n+3}{0}-\binom{n+3}{1}+\binom{n+3}{2}\right]$$  So we get $$ = \frac{3!}{(n+1)(n+2)(n+3)}\left[1-(n+3)+\frac{(n+3)(n+2)}{2}\right] = \frac{3!}{(n+1)(n+2)}\times \frac{n^2+3n+2}{2} = \frac{3!}{(n+1)(n+2)(n+3)}\times \frac{(n+1)(n+2)}{2} = \frac{3!}{2(n+3)}$$  Can we prove it Using Combinatorial way,bcz above method is very lengthy  If yes then plz explain here  Thanks Using Illustrator CS6 to create shape out of multiple paths Regex matches but shouldn't How to get the current directory in a C program? I'm making a C program where I need to get the directory that the program is started from.  This program is written for UNIX computers. I've been looking at opendir() and telldir(), but telldir() returns a off_t (long int), so it really doesn't help me.   How can I get the current path in a string (char array)? How can I obtain total number of points? My "network reputation" graph does not accurately reflect my accounts Drush installed and running; No Drupal site found even with uri specified After much trial and tribulation, I thought I had drush all ready to roar. Much excitement. But then, no joy...  Drush is working. The sites operate fine via MAMP. Regardless, a "drush cc all" command returns:   No Drupal site found, only 'drush' cache was cleared.                                          [warning] 'all' cache was cleared.                                                                       [success]   This question has stumped drupalcon attendees and very experienced developers. Any ideas?  I am on Mac OS 10.9.3 using MAMP (free) Version 3.0.5  Here is my drush status:   Drupal version         :  7.29-dev                                 Site URI               :  http://default                           Database driver        :  mysql                                    Database hostname      :  localhost                                Database username      :  db_user                             Database name          :  db_name                        PHP executable         :  /usr/bin/php                             PHP configuration      :                                           PHP OS                 :  Darwin                                   Drush version          :  7.0-dev                                  Drush temp directory   :  /tmp                                     Drush configuration    :                                           Drush alias files      :                                           Drupal root            :  /Applications/MAMP/htdocs/mysite.dev   Site path              :  sites/default       Have tried executing drush from /Applications/MAMP/htdocs/mysite.dev; from /Applications/MAMP/htdocs/mysite.dev/sites/default; and using drush cc all --uri=http://localhost/mysite.dev  Tried running drush from sites/default. Same result. Python/Matplotlib - Is there a way to make a discontinuous axis? Does kinetic friction increase as speed increases? Possible Duplicate:          Layman alert...I last did physics in high school, and am just trying to understand something my son is working on.   To keep a box moving across the floor at a constant velocity I need to apply a force equal and opposite to that of the  force working on it.  If I start applying a force greater than the kinetic friction force, the box will speed up. Will it keep speeding up indefinitely, or will the kinetic friction force I need to overcome increase as the box gets faster? Is voting to balance in the spirit of the site? The other day I saw an answer which was ok. Not great but not bad. So no reason to upvote or downvote. However the answer already had a single downvote. I felt this was unfair so upvoted the answer to keep it at what I felt was a fair score. It wasn't until afterward that it occurred to me that I should have perhaps solely voted on the content of the answer.  Is this a reasonable reason for an upvote or should I have left the answer alone? My players have been scheming with rapid entry tactics for the megadungeon I've recently started running. Unfortunately, the monsters are aware of the adventurers, and this has lead to a weird question of priority. Given the following situation (which I'm pretty sure is going to happen next session in some form or another) what happens?     Alice the adventurer readies an action; if her teammate Carlos opens   the door, she's going to throw the alchemists fire through the door,   which should do enough damage to kill any goblins hiding there.      Meanwhile, on the other side of the door, Bob the goblin is lying in   wait. He readies an action; if the door opens, he's going to hit the   switch to open the trapdoor in the next room, which should drop any    pesky adventurers into a pit with spikes at the bottom.      Carlos opens the door.   I know what happens when , but what happens when multiple readied actions get triggered at the same time? My guess would be an opposed reflex save or initiative check of some kind to see who goes first, but that's entirely just intuition speaking. The rulebook doesn't seem to speak to the issue. How do I merge two dictionaries in a single expression (taking union of dictionaries)? Manually installing a program on Debian Qualitative variable coding in regression leads to "singularities" Let me edit a post in the close review, then vote to close it I think we need a button that says Edit and Close added to the Review Close button options.  Many of these closed posts will be around forever (and should be, closed should not just be a path to deletion), so they need editing.  If I edit it now it goes away, with the only option being a back click to get back to the review, and then click into the post and edit it.  We have an Edit and Reopen button, so this would fit in just fine. How to favorite a question from Android app? I've found an interesting question when browsing Freelancers.SE. I've tried to star (favorite) the question but I couldn't find the option...  How to star a question from the Android app? Take a screenshot of a webpage with JavaScript? Is it possible to to take a screenshot of a webpage with JavaScript and then submit that back to the server?  I'm not so concerned with browser security issues. etc. as the implementation would be for . But is it possible? What is the correct possessive for nouns ending in "‑s"? Can I use Mage Hand to fly by Polymorphing myself and picking myself up with the hand? Could I first cast Mage Hand, then Polymorph into a Tiny creature less than 10 pounds then use the Mage Hand to pick myself up and fly at 30 Ft per turn?  Polymorph says:     The new form can be any beast ... The target's game statistics,   including mental ability scores, are replaced by the statistics of the   chosen beast. It retains its alignment and personality ... The   creature is limited in the actions it can perform by the nature of its   new form and it can't speak, cast spells, or take any other action   that requires hands or speech.   This keeps me from casting spells, which keeps me from just casting Mage Hand to fly as long as I want to over and over. But for that initial duration of the Mage Hand cantrip, could I use the Mage Hand to fly as a Tiny polymorphed creature until the spell runs out? Can a PC with the Alert feat alert his friends? Assume the following situation: The party has been surprised by an ambush. Every PC is surprised except PC Bob because he has the Alert feat. Thanks to his high initiative bonus Bob gets to go first. He shouts "look out" to alert his party members of the imminent threat. The idea is that his party members are no longer surprised because he warned them.   While I think that this makes sense from a storytelling perspective, I am afraid this would be too strong. as it allows one PC with the Alert feat to give the "not surprised" benefit to other members of his party pretty much for free.  Is this allowed? Are there rules or an official ruling or similar on this?  If not, do you have any experience with this situation, and how did it play out in your games?