In the following code, I need to return b so that I can use it in another function. I tried testing to see if b would be returned but when I run def main and print(n_boxes), it gives me None. However if I changed return b to print(b) and print(n_boxes) to n-boxes, I get the correct output.     def subsets(a, b, lo):     hi = len(a)     subs_2 = []     if (lo == hi):       return b     else:       c = b[:]       b.append(a[lo])       subsets (a, c, lo + 1)       subsets (a, b, lo + 1)   def main():     boxes = [[1, 2, 3], [4, 5,6], [6, 6, 9], [3, 8, 4]]     b = []     n_boxes = subsets(boxes, b, 0)     print(n_boxes)   main()   I am not sure what I am doing wrong. I need the values for b. Thanks!  Ok so I want all possible subsets to be returned. The "def subsets" can do that. With "print b" my output is  [] [[3, 8, 4]] [[6, 6, 9]] [[6, 6, 9], [3, 8, 4]] [[4, 5, 6]] [[4, 5, 6], [3, 8, 4]] [[4, 5, 6], [6, 6, 9]] [[4, 5, 6], [6, 6, 9], [3, 8, 4]] [[1, 2, 3]] [[1, 2, 3], [3, 8, 4]] [[1, 2, 3], [6, 6, 9]] [[1, 2, 3], [6, 6, 9], [3, 8, 4]] [[1, 2, 3], [4, 5, 6]] [[1, 2, 3], [4, 5, 6], [3, 8, 4]] [[1, 2, 3], [4, 5, 6], [6, 6, 9]] [[1, 2, 3], [4, 5, 6], [6, 6, 9], [3, 8, 4]]   I want to be able to use the above subsets individually. So I am trying to find a way to return the subsets and be able to write a function that will give me subsets of length two. To clarify, I would be able to write such a function, but I would need the individual subsets first.
How do you generate all the permutations of a list in Python, independently of the type of elements in that list?  For example:  permutations([]) []  permutations([1]) [1]  permutations([1, 2]) [1, 2] [2, 1]  permutations([1, 2, 3]) [1, 2, 3] [1, 3, 2] [2, 1, 3] [2, 3, 1] [3, 1, 2] [3, 2, 1]
True Definition of the Real Numbers I've found lots of resources that say this is a real number if it's not rational, but what is a real number, really?  I mean what is the definition of a real number?  If nothing else, anyone know of a resource where I could find out myself?  Thanks! I was recently thinking what information do we get from a matrix. So if we say the columns (or rows) of a matrix define the basis of a system, say vectors of 3 dimensional space. Then the determinant will tell about the volume of the space enclosed by those vectors. Does trace give any information about the space? Expected value in an urn problem In an urn there are $n$ red balls and $m$ blue balls. I extract them without replacement. Let $X$=time of first blue. What is $E(X)$?  I found PMF of $X$ and it is, if $k &gt; n+1$  $$P(X=k) =\frac{n(n-1) \dots (n-k+1)m}{(m+n)(m+n-1) \dots (n+m-k+1)}$$  How could I evaluate $E(X)$?  Edit: I'm looking for an explicit form of $E(X)$ How to combine two strings together in PHP? Find all solutions to the equation $(z+1)^6=z^6$. Express the solutions in simplified rectangular form. Hint: Clearly $z=0$ is not a solution. $$(z+1)^6=z^6 $$ $$\frac{(z+1)^6}{z^6 }=1$$ $$\left(\frac{(z+1)}{z }\right)^6=1$$ $$\left(\frac{(z+1)}{z }\right)^6=\cos(2*\pi*k)+i\sin(2*\pi*k)$$ $$\frac{(z+1)}{z }=\left(\cos(2*\pi*k)+i\sin(2*\pi*k)\right)^{1\over6}$$ $$1+\frac{1}{z }=\cos({2*\pi*k\over6})+i\sin({2*\pi*k\over6})$$  $$\frac{1}{z }=(\cos({\pi*k\over3})-1)+i\sin({\pi*k\over3})$$ $$\frac{1}{(\cos({\pi*k\over3})-1)+i\sin({\pi*k\over3}) }=z$$ I dont know how else to solve this. A lot of help is appreciated. Also i know that k should go from 1-5. How to terminate a background process? I have started a wget on remote machine in background using &amp;. Suddenly it stops downloading. I want to terminate its process, then re-run the command. How can I terminate it?  I haven't closed its shell window. But as you know it doesn't stop using Ctrl+C and Ctrl+Z. Converse to Chinese Remainder Theorem So as seen on this question , we know that if $(n,m) \neq 1$, then $\mathbb{Z} /mn \mathbb{Z} \ncong \mathbb{Z}/n\mathbb{Z} \times \mathbb{Z}/m\mathbb{Z}$, because the right hand side does not have an element of order $nm$.  But take a more general setting. Let $R$ be a commutative ring, and let $A,B$ be ideals in $R$. $A$ and $B$ are said to be comaximal if $A+B=R$. If $A, B$ are comaximal, then we have: $R/AB \cong R/A \times R/B$. In this setup, is the converse true?      If we have $A, B$ ideals in $R$ such that $R/AB \cong R/A \times R/B$, do we always have that $A$ and $B$ are comaximal? Why does my apple not weigh 500 tons? Related to this question:   $E=mc^2$ - energy equals mass. So, if an object has gravitational potential energy relative to another object, it should have additional mass to represent that extra energy.  So, if I have an apple in my hand, it should have quite a large amount of gravitational potential energy relative to a black hole at the edge of the observable universe. I did a quick calculation of how much this gravitational potential energy would be (using Newton's Law of Gravitation) and it came out to be the equivalent of around 500 tons (and that's just for one black hole!).  So, why does my apple not weigh a lot more than it appears to?  EDIT: Here's my calculation of the GPE:  Assumptions:   The apple has mass $m_a=0.3 kg$ The black hole has a mass equal to 1000 solar masses, $m_b=2\times10^{33} kg$ Distance between the apple and black hole is 60 billion light years   Obviously $GPE=mgh$ can't be used, because the gravitational acceleration is not constant and varies with distance, so it has to be integrated.  I used Newton's Law of Gravitation to provide the acceleration:  $$ F=\frac{G{m_1}{m_2}}{h^2} $$  A small change in height produces a small change in energy, which can be used to integrate:  $$ \begin{eqnarray*} \delta E&amp;=&amp;F \delta h\\ \int_0^EdE&amp;=&amp;G{m_a}{m_b}\int_1^R\frac{1}{h^2}dh \end{eqnarray*} $$  I'm integrating the force starting at 1m from the center of the black hole, as the force goes to infinity at $h=0$. It's a little crude, but it should provide a conservative estimate.  $$ \begin{eqnarray*} E&amp;=&amp;G{m_a}{m_b}(1-\frac{1}{R})\\ E&amp;\approx&amp; G{m_a}{m_b}\;\;\;\;\;\;(R&gt;&gt;1)\\ G&amp;=&amp;6.673\times 10^{-11}\;\;N(\frac{m}{kg})^2\\ G{m_a}{m_b}&amp;=&amp;4\times 10^{22}\;\;Nm\\ E&amp;=&amp;mc^2\\ \Delta m&amp;=&amp;\frac{4\times 10^{22}}{(3\times 10^8)^2}\\ &amp;\approx&amp;444,000\;\;kg \end{eqnarray*} $$  So, a little short of 500 tons, but still pretty big! How do I reset the Windows XP Administrator password? Ted Shifrin on this site posed an interesting problem to me: show that   $$ \lim_{(x,y) \to (0,0)} \frac {|x|^ \alpha |y|^ \beta} {|x|^ \gamma + |y|^ \delta} \text {exists} \iff \frac\alpha\gamma + \frac\beta\delta &gt; 1, \,\,\,\,\text{where } \alpha, \beta, \gamma, \delta &gt;0$$  I think I've got the $(\Leftarrow)$ direction as follows: assume WLOG that $\gamma \leq \delta$. Then switch to polar coordinates and get   $$\frac {r^ {\alpha + \beta} (*) } {r^\gamma (1(*) + r^{\delta - \gamma}(*))},$$  where $(*)$ represents some trig stuff that is bounded near zero.   Edit: I need to make sure that $(1(*) + r^{\delta - \gamma}(*))$ is bounded below here.  The other direction is giving me some trouble. It seems we need a lower bound for the fraction (something to force to zero), and I'm not sure where to find one. In particular, I'm not sure what to do with the denominator. Any ideas? Update help center article on search to reflect the new position of the search box The page  says:      Enter search terms in the search box that appears in the upper right corner of every page    But the box is not there. Which stats / gear can get the best our of wasteland exploration? Trying to get the best out of wasteland exploration here! I get it that you'd obviously need a big gun for survival out there, but apart from that, I'm wondering which stats / gear can get the best out of exploration.    How would you choose who to send out exploring from your dwellers. Which stat is the most important to choose explorers? Strength or endurance maybe? Does it make much of a difference equipping combat outfits? If so, whats the most important stat to boost through outfits? Boolean expression (grammar) parser in c++ How do you handle "that that"? The double "that" problem How can I resize an ext root partition at runtime? How can I increase the size of the root partition of a system at runtime?   I have a partition that is not allocated after the root partition (which is also ext4), how can I add that unallocated space to the space allocated to the root partition without having to shutdown the server? Entire function bounded by polynomial of degree 3/2 must be linear. The problem is as follows:     Suppose $f$ entire satisfying   $$ |f(z)| \leq A + B |z|^{3/2} $$   for some fixed $A,B &gt; 0$. Prove that $f$ is a linear polynomial.   I know I want to reduce it to a function where I can use a Cauchy bound, but I'm not sure how. Are you allowed to stack Divine Smite and Eldritch Smite on the same attack? Is it possible to save settings for Microsoft Paint? After closing paint the last used settings went back to default. I want them to be saved. Like the selected Brush-Tool, Color, Line-strength, etc.  Either after every usage or I define one I use most. Maybe through the registry or by start parameters? After the upgrade of salesforce to Spring 15, I am getting this error "Error: You have exceeded the maximum number (5) of Apex scheduled jobs." when scheduling more than 5 batches. I have this issue in several environment. I used to more than 20 batches scheduled at once.   On the link below, it says that I can schedule up to 100 batches but I am being restricted to 5 only.   I can't have more than 5 jobs here. If $\sum_{n_0}^{\infty} a_n$ diverges prove that $\sum_{n_0}^{\infty} \frac{a_n}{a_1+a_2+...+a_n} = +\infty $ I've tried to use the limit test: $\lim_{n \rightarrow \infty} \frac{a_n}{b_n} = C$ in the series of $a_n$ and $\frac{a_n}{a_1+a_2+...+a_n}$ but it was inconclusive.  The question does not especify the sign of $a_n$ but proving it for positives would already help.  I think the sign can change as long as the partial sums never get to be zero. Like if the series has only negative numbers the result seems to stil hold.