letters = ['a', 'b', 'c']   Assume this is my list. Where for i, letter in enumerate(letters) would be:  0, a 1, b 2, c   How can I instead make it enumerate backwards, as:  2, a 1, b 0, c
7042
So I can start from len(collection) and end in collection[0].  I also want to be able to access the loop index.
18458
How to make enumerate list format numbers like this:     REG/001 (content)      REG/002 (content)      REG/003 (content)   I already managed to do the following:   \begin{enumerate}[label=\textbf{REG/\arabic*},leftmargin=*] \item content \end{enumerate}   using   \usepackage{enumitem}   but I don't know how to add leading zeros.
95623
How can I convert a List&lt;MyObject&gt; to an IEnumerable&lt;MyObject&gt; and then back again?  I want to do this in order to run a series of LINQ statements on the List, e. g. Sort()
30381
I have the following array, which I would like to reindex so the keys are reversed (ideally starting at 1):  Current array (edit: the array actually looks like this):  Array (  [2] =&gt; Object     (         [title] =&gt; Section         [linked] =&gt; 1     )  [1] =&gt; Object     (         [title] =&gt; Sub-Section         [linked] =&gt; 1     )  [0] =&gt; Object     (         [title] =&gt; Sub-Sub-Section         [linked] =&gt;      )  )   How it should be:  Array (  [1] =&gt; Object     (         [title] =&gt; Section         [linked] =&gt; 1     )  [2] =&gt; Object     (         [title] =&gt; Sub-Section         [linked] =&gt; 1     )  [3] =&gt; Object     (         [title] =&gt; Sub-Sub-Section         [linked] =&gt;      )  )
71175
I need to move backwards through an array, so I have code like this:  for (int i = myArray.Length - 1; i &gt;= 0; i--) {     // Do something     myArray[i] = 42; }   Is there a better way of doing this?  Update: I was hoping that maybe C# had some built-in mechanism for this like:  foreachbackwards (int i in myArray) {     // so easy }   Update 2: There are better ways. Rune takes the prize with:  for (int i = myArray.Length; i-- &gt; 0; ) {         //do something } //or for (int i = myArray.Length; i --&gt; 0; ) {     // do something }   which looks even better in regular C (thanks to Twotymz):  for (int i = lengthOfArray; i--; ) {         //do something }
119502
I have an enumerate list in this MWE.  \documentclass[]{beamer} \usetheme{Madrid} \setbeamertemplate{items}[circle]  \begin{document}  \begin{frame} \frametitle{Example} \begin{enumerate} \item First one \item Second one \item Third one \end{enumerate} In the above list, 2 and 3 are what more important. \end{frame}  \end{document}   I want "2" and "3" in the text to be the same as in the list, a blue solid circle with white numbers.  How do I do that? Thank you.
62089
I have a problem regarding alignment for my equations.  This dummy program shows the problem:  \documentclass{article} \usepackage{amsmath} \begin{document}  \begin{enumerate}     \item First do this     \begin{align}     c^2 &amp;= a^2 + b^2     \end{align}      \item Then do this      \begin{align}     variable &amp;= c^2     \end{align} \end{enumerate}  \end{document}     I would like the = to be aligned under each other, but still be able to list them inside the enumerate.  Any suggestions?
7279
Given an array of characters which forms a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.  Example input and output:  &gt;&gt;&gt; reverse_words("this is a string") 'string a is this'   It should be O(N) time and O(1) space (split() and pushing on / popping off the stack are not allowed).  The puzzle is taken from .
82550
Find the number of ways a string of numbers (that may contain similar items) can be deranged, so that a number is not placed in the same place as it or its similar numbers were placed. For example, $\{0,0,0,1,1,1\}$ can be arranged in only one way, and that is $\{1,1,1,0,0,0\}$. $\{0,0,0,1,1,1,1\}$ cannot be arranged in any way. $\{1,2,2,14\}$ can be arranged in $2$ ways, i.e $\{2,1,14,2\}$, $\{2,14,1,2\}$. $\{1,1,2,2,14\}$ can be arranged in $5$ ways, i.e $\{2,2,1,1,14\}$, $\{14,2,1,1,2\}$, $\{2,2,14,1,1\}$, $\{2,2,1,14,1\}$, $\{2,14,1,1,2\}$.  Please do try and respond. Thanks in advance.
97781
when I use   \begin{enumerate}[I] \item  ...   I get   I II   how I can get   i ii   ?  I try with   \renewcommand{\theenumi}{\roman{enumi}} \renewcommand{\labelenumi}{\theenumi}   in the begin of file, but not fix the problem.
94558
\documentclass[12pt]{article}  \usepackage{amsmath,amsthm,amssymb,amsfonts} \usepackage{enumerate}  \newenvironment*{exercise}{}  \newcommand{\R}{\mathbb{R}}  \begin{document}  \begin{exercise}{1.10.} Show that $B=\{[a,b)\subset\R|a&lt;b\}$ is a basis for a topology on $\R$.\\ \begin{enumerate} \item{stuff...} \item{stuff...} \end{enumerate} \end{exercise}  \end{document}   My main concern is that the list numbers in the list and the text in the instructions line up. That is that the S in show is lined up with the 1 and 2 etc in the list.
18220
I'm writing some cross-platform code between Windows and Mac.  If list::end() "returns an iterator that addresses the location succeeding the last element in a list" and can be checked when traversing a list forward,  what is the best way to traverse backwards?  This code workson the Mac but not on Windows (can't decrement beyond first element):  list&lt;DVFGfxObj*&gt;::iterator iter = m_Objs.end(); for (iter--; iter!=m_Objs.end(); iter--)// By accident discovered that the iterator is circular ? { }   this works on Windows:  list&lt;DVFGfxObj*&gt;::iterator iter = m_Objs.end();     do{         iter--;     } while (*iter != *m_Objs.begin());   Is there another way to traverse backward that could be implemented in a for loop?
84084
I'm trying to get a list of custom labels. Here is what I've tried:  \begin{enumerate}[Exercise (1)]  \item first  \item second  \end{enumerate}   This results in each item being labeled as: Exerc#se (#)  Where # is the number of the item in the list. How can I make the "i" in exercise not be pattern matched?   Using a \ doesn't work, it causes syntax error.
40204
The picture above shows what I am referring to. I'm looking for a way to change these " A, B, C, ..." labels to describe better the content below each.    A would contain what date, B  what length I run, etc.
1888
I want to do something like String.Format("[{0}, {1}, {2}]", 1, 2, 3) which returns:  [1, 2, 3]   How do I do this in Python?
79687
This is a wild one: can anyone write a code that converts a number into the corresponding word? e.g.:  4 -&gt; 'four' 31 -&gt; 'thirty-one'   and so on. Obviously, it is not enough to build an array in which you can store the numbers and the word associated with it and then just print instead of the number the stored word. What complicates matters more, are numbers like 11 ('eleven'). I intend to use it for numbering equations. So, anybody up to it?
37834
Sometimes, I want to have enumerate lists in LaTeX start at other than the first value (1, a, i, etc.) How can I make an enumerate list start at an arbitrary value?