Kaydet (Commit) dc62aeca authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Add a new looping idiom

üst 5ce2fecf
......@@ -2162,6 +2162,21 @@ What is your quest? It is the holy grail.
What is your favorite color? It is blue.
\end{verbatim}
To loop over a sequence in reverse, first specify the sequence
in a forward direction and then call the \function{reversed()}
function.
\begin{verbatim}
>>> for i in reversed(xrange(1,10,2)):
... print i
...
9
7
5
3
1
\end{verbatim}
\section{More on Conditions \label{conditions}}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment