I am attempting to create a small python program that takes a string from a user that contains the alphabetic representation for numbers as input.  Such as:  one two twelve two three forty four    Then it would return the actual numeric version of the words as output.  Example:  1 2 12 2 3 44   I have tried to do this using a dictionary of the numbers being associated with there numeric counterparts but I know that is the wrong way to do it.  Example:  {"one": 1,"two":2}   Can anyone offer some advice on how to do it?
I need to convert one into 1, two into 2 and so on.  Is there a way to do this with a library or a class or anything?
When light waves enter a medium of higher refractive index than the previous, why is it that:  Its wavelength decreases? The frequency of it has to stay the same? Consider the surface $S$ in $\mathbb{R}^3$ given by the graph of $f(x, y) = xy^2 − 2y^2 + e^x$ . Calculate the intersection point of the tangent planes to $S$ above $(x, y) = (0, 0), (0, 1)$, and $(0, 2)$.  Can someone guide me through solving this problem? I am confused on where to start because we didn't cover this in class. Thanks so much Why can't Python's raw string literals end with a single backslash? Technically, any odd number of backslashes, as described in .  &gt;&gt;&gt; r'\'   File "&lt;stdin&gt;", line 1     r'\'        ^ SyntaxError: EOL while scanning string literal &gt;&gt;&gt; r'\\' '\\\\' &gt;&gt;&gt; r'\\\'   File "&lt;stdin&gt;", line 1     r'\\\'          ^ SyntaxError: EOL while scanning string literal   It seems like the parser could just treat backslashes in raw strings as regular characters (isn't that what raw strings are all about?), but I'm probably missing something obvious. Give each site a parallel site for polling, recommendations and subjective-ish stuff Stuff like polls, recommendations based on subjective constraints, puzzles, webcomics etc. do not belong on the serious main SE sites, where professionals should be considered at work and having just a few spare minutes ("code's compiling") to answer questions, so they should not be distracted by such things. However, I'd also like to have a home for these things still using the SE engine. For the reason I mentioned before, this needs to be a separate place though. Let's call it four.[sitename-here].com. Find the value of : $\lim_{n\to\infty}\prod_{k=1}^n\cos\left(\frac{ka}{n\sqrt{n}}\right)$ Understanding ROC curve Why does cout print char arrays differently from other arrays? I'm using C++ to understand how exactly pointers work. I have this piece of code using arrays, which I'm using just to understand how the equivalent works with pointers.  int main() {         int arr[10] = {1,2,3};         char arr2[10] = {'c','i','a','o','\0'};     cout &lt;&lt; arr &lt;&lt; endl;     cout &lt;&lt; arr2 &lt;&lt; endl; }   However when I run this, arr outputs the address of the first element of the array of ints (as expected) but arr2 doesn't output the address of the first element of the array of chars; it actually prints "ciao".  What is it that I'm missing or that I haven't learned yet about this? Redirect all requests to HTTPS, except for one subdirectory These androids show up day in suburban USA and start offering all their services for free - they are much better than the robot helpers that cost money - the protagonist is a salesman of the latter.   Soon, the 'helpers' are everywhere, and human beings effectively cannot do anything without these things keeping people 'safe'. Humans become infantilized and controlled.   Eventually it's discovered that one man created them, and he's been kept prisoner by them to prevent for his own safety.   This seems remarkably similar to the conclusion of the I, Robot movie. Please rate and comment. I want to improve; constructive criticism is highly appreciated. Please take style into account as well.  The following proof is solely based on vector space related axioms. Axiom names are italicised. They are defined in Wikipedia (see vector space article).  Vector spaces - Multiplying by zero scalar yields zero vector  \begin{array}{lrll} \text{Let} &amp; \dots &amp; \text{be} &amp; \dots \\ \hline &amp; F &amp;&amp; \text{a field.} \\ &amp; V &amp;&amp; \text{a vector space over $F$.} \\ &amp; 0 &amp;&amp; \text{an identity element of addition of $F$.} \\ &amp; \mathbf{0} &amp;&amp; \text{an identity element of addition of $V$.} \\ &amp; \mathbf{v} &amp;&amp; \text{an arbitrary vector in $V$.} \\ \end{array}  $$\text{Then, }0\mathbf{v} = \mathbf{0}.$$  Proof. We will denote by $1$ an identity element of scalar multiplication; we will denote by $(-\mathbf{v})$ an additive inverse of $\mathbf{v}$. \begin{align*} 0\mathbf{v} &amp;= 0\mathbf{v} + \mathbf{0}                     &amp;&amp; \text{by }\textit{Identity element of vector addition} \\ &amp;= 0\mathbf{v} + (\mathbf{v} + (-\mathbf{v}))   &amp;&amp; \text{by }\textit{Inverse elements of vector addition} \\ &amp;= (0\mathbf{v} + \mathbf{v}) + (-\mathbf{v})   &amp;&amp; \text{by }\textit{Associativity of vector addition} \\ &amp;= (0\mathbf{v} + 1\mathbf{v}) + (-\mathbf{v})  &amp;&amp; \text{by }\textit{Identity element of scalar multiplication} \\ &amp;= ((0 + 1)\mathbf{v}) + (-\mathbf{v})          &amp;&amp; \text{by }\textit{Distributivity of scalar multiplication (field addition)} \\ &amp;= ((1 + 0)\mathbf{v}) + (-\mathbf{v})          &amp;&amp; \text{by }\textit{Commutativity of field addition} \\ &amp;= (1\mathbf{v}) + (-\mathbf{v})                &amp;&amp; \text{by }\textit{Identity element of field addition} \\ &amp;= \mathbf{v} + (-\mathbf{v})                   &amp;&amp; \text{by }\textit{Identity element of scalar multiplication} \\ &amp;= \mathbf{0}                                   &amp;&amp; \text{by }\textit{Inverse elements of vector addition} \\ \end{align*} QED How do malloc() and free() work? Why can a function modify some arguments as perceived by the caller, but not others? I'm trying to understand Python's approach to variable scope. In this example, why is f() able to alter the value of x, as perceived within main(), but not the value of n?  def f(n, x):     n = 2     x.append(4)     print('In f():', n, x)  def main():     n = 1     x = [0,1,2,3]     print('Before:', n, x)     f(n, x)     print('After: ', n, x)  main()   Output:  Before: 1 [0, 1, 2, 3] In f(): 2 [0, 1, 2, 3, 4] After:  1 [0, 1, 2, 3, 4] Cards entering the battlefield simultaneously and "Enter the Battlefield" effects Accessing my Windows 7 files from my Ubuntu account I have just installed Ubuntu on my computer and I have windows 7 as my other operating system. is there a way that I can access my windows 7 files from my Ubuntu installation? If $E[X|Y]=Y$ almost surely and $E[Y|X]=X$ almost surely then $X=Y$ almost surely Large snap packages because of dependencies In what sense is a scalar field observable in QFT? Consider a QFT consisting of a single, hermitian scalar field $\Phi$ on spacetime (say $\mathbb R^{3,1}$ for simplicity).  At each point $x$ in spacetime, $\Phi(x)$ is an observable in the sense that it is a hermitian operator (operator-valued distribution) on the Hilbert space of the theory, but is each such operator observable in a stronger, more physical sense?  Is there an experiment one could hypothetically perform to measure the value of such a field at a given spacetime point? This is one of those questions I glossed over while learning QFT, but now it's bugging me.  In particular, I think this point is central in preventing me from understanding certain basic assumptions in QFT such as microcausality which I also never really think about anymore. Laravel - Populating Select List with Derived Values What's the rationale for requiring that a field be a $\boldsymbol{non}$-$\boldsymbol{trivial}$ ring? The title pretty much says it all.  Of course, one answer (IMO unsatisfactory) to such questions goes something like "a definition is a definition, period."  In my experience, mathematical definitions are rarely completely arbitrary.  Therefore I figure there must be a good reason for insisting that a field be a non-trivial ring (among other things), but it's not obvious to me.  I realize that a trivial ring would make for a very boring field, but it is also a rather boring ring, and yet it is not disallowed as such.  EDIT: I found a hint of a rationale in the statement that "the zero ring ... does not behave like a finite field," but I could not find in the  for this assertion exactly how the zero ring fails to behave like a finite field. What are the integer solutions to $a^{b^2} = b^a$ with $a, b \ge 2$