I am running python 3.0 and need to make a permutation from a list of 7 numbers in that list, but I am not finding any decent sample code or guide to create all the permutations.   Could someone please put some sample code as to how I would make and be able to print all the permutations.
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]
Can linear momentum be conserved before and after collision in the presence of an external force? I'm a physics tutor for 11th and 12th grade students. I taught my students that momentum is conserved only when the net external force on the system is zero. But in the books we are following, momentum was conserved in the following cases in spite of presence of an external force:   A body (mass m1) is dropped from a tower (height h) and another body (mass m2) is projected vertically upward with initial velocity u. Find the velocities just after collision. (Gravitational force is the external force) Two bodies projected towards each other on a rough table surface, with all required parameters given asked to find the velocities after collision. (frictional force is the external force) Body explodes in mid air. Momentum is conserved before and after explosion. (Again gravitational force is the external force)   I explained to my students in all these cases though an external force is present it has negligible effect. But I'm not satisfied with my answer.  EDIT: Thank you for the comments and answer. It is clear that contribution of external force to change in momentum is negligible. Can someone do the calculation of taking change in momentum into consideration and showing that it is negligible? I try to download a file with wget and curl and it is rejected with a 403 error (forbidden).  I can view the file using the web browser on the same machine.  I try again with my browser's user agent, obtained by . I do this:  wget -U 'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0' http://...   and  curl -A 'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0' http://...   but it is still forbidden. What other reasons might there be for the 403, and what ways can I alter the wget and curl commands to overcome them?  (this is not about being able to get the file - I know I can just save it from my browser; it's about understanding why the command-line tools work differently)  update  Thanks to all the excellent answers given to this question. The specific problem I had encountered was that the server was checking the referrer. By adding this to the command-line I could get the file using curl and wget.  The server that checked the referrer bounced through a 302 to another location that performed no checks at all, so a curl or wget of that site worked cleanly.  If anyone is interested, this came about because I was reading  page to learn about embedded CSS and was trying to look at the site's css for an example. The actual URL I was getting trouble with was  and the curl I ended up with is  curl -L -H 'Referer: http://css-tricks.com/forums/topic/font-face-in-base64-is-cross-browser-compatible/' http://cloud.typography.com/610186/691184/css/fonts.css   and the wget is   wget --referer='http://css-tricks.com/forums/topic/font-face-in-base64-is-cross-browser-compatible/' http://cloud.typography.com/610186/691184/css/fonts.css   Very interesting. Some sites are . What additional sites should the chat support?  One suggestion per answer. So, I'm working on a control station that has buttons. It is a one-mesh creation, that means, I don't want to create buttons and things like that separated from the main mesh, but as you can see, I have problems. I would like to make the highlighted parts to be one with the main part around them. I've tried everything, and I have this problem on multiple creations. Any idea?  Update: I've added another example of the problem. I want them to be one face, instead of two. (2nd picture) How to run grep on a single column? Are there any way to execute a query inside the string value (like eval) in PostgreSQL? How are long-term capital gains taxed if the gain pushes income into a new tax bracket? Prove that $\left | \frac{a-b}{a+b}+\frac{b-c}{b+c}+\frac{c-a}{c+a} \right | < \frac{1}{8}.$ Let $a,b,$ and $c$ be the lengths of the sides of a triangle. Prove that $$\left | \dfrac{a-b}{a+b}+\dfrac{b-c}{b+c}+\dfrac{c-a}{c+a} \right | &lt; \dfrac{1}{8}.$$   The best idea I had was to expand the fractions to get something nicer. So we get $\dfrac{a-b}{a+b}+\dfrac{b-c}{b+c}+\dfrac{c-a}{c+a} = \dfrac{a^2 b-a^2 c-a b^2+a c^2+b^2 c-b c^2}{(a+b) (a+c) (b+c)}.$ Then I would try to relate this to side lengths of a triangle to prove the desired inequality but that is the step where I am unsure. What does template  mean? How does Java's PreparedStatement work? Why Process Builder doesn't work on Delete Scenario? Python — How can I find the square matrix of a lower triangular numpy matrix? (with a symmetrical upper triangle) Height of colorbox What's the difference between real and effective aperture? I understand that the simple idea that f-stop is focal length divided by aperture really applies to a simple single-glass lens, not the compound lens systems used to provide good image quality in modern lenses.  I've heard that in this case, what matters is the ratio of the aperture as it appears through the front element. Why the front element, and not the back (which would be the "point of view" of the sensor or film)?  What about for effects such as diffraction? Does the literal physical aperture size matter, or is it the effective size? Use of 'const' for function parameters I accidentally issued some commands I thought were safe in the terminal, and I ended up with no System Settings and lots of other missing functionality, but the OS still boots normally. I've decided I want to install Lubuntu instead of fixing Ubuntu for a fresh start and since my laptop is running on a 1GHz dual core AMD CPU.  I created a bootable USB as I usually do and placed Lubuntu 17.10 amd64 using Rufus 2.14.1086. I have GRUB that was installed with Ubuntu upon first install I still have Win8.1 which I still want to keep.  PS: I also tried creating a startup disk from Ubuntu  The question is: How can I boot from USB with GRUB2 so I can overwrite Ubuntu? Find the sum : $\frac{1}{\cos0^\circ\cos1^\circ}+\frac{1}{\cos1^\circ \cos2^\circ} +\frac{1}{\cos2^\circ \cos3^\circ}+......+$ Find the sum of the following :   (i) $$\frac{1}{\cos0^\circ \cos1^\circ}+\frac{1}{\cos1^\circ\cos2^\circ} +\frac{1}{\cos2^\circ \cos3^\circ}+......+\frac{1}{\cos88^\circ \cos89^\circ}$$  I tried :  $$\frac{1}{\cos1^\circ}\left[\frac{\cos(1^\circ-0^\circ)}{\cos0^\circ\cos1^\circ} + \frac{\cos(2^\circ-1^\circ)}{\cos1^\circ\cos2^\circ}+...\right]$$  = $$\frac{1}{\cos1^\circ}\left[\frac{\cos1^\circ\cos0^\circ}{\cos0^\circ\cos1^\circ} - \frac{\sin1^\circ \sin0^\circ}{\sin0^\circ\cos1^\circ} + \frac{\cos2^\circ \cos1^\circ}{\cos1^\circ\cos2^\circ} -\frac{\sin2^\circ \sin1^\circ}{\cos1^\circ\cos2^\circ}...\right]$$  For this, as well, I am not getting any pattern to solve further. Please suggest, thanks. Consider the sequence $(\phi_n)_{n\in \mathbb{N}}$ of test-functions $\phi_n\in \mathcal{D}(\mathbb{R})$ defined by  $$\phi_n(x) = \dfrac{n}{\sqrt{\pi}}e^{-n^2x^2}.$$  I want to show that this is a delta sequence, in the sense that:  $$\lim_{n\to\infty}(\phi_n,\psi)=(\delta,\psi)=\psi(0), \quad \forall \psi\in \mathcal{D}(\mathbb{R}).$$  In that case we know that we have  $$(\phi_n,\psi)=\dfrac{n}{\sqrt{\pi}}\int_{-\infty}^{\infty}e^{-n^2x^2}\psi(x)dx.$$  The problem here is to compute this integral. The function $x\mapsto e^{-n^2x^2}\psi(x)$ has no singularities, hence contour integration wouldn't help. Integration by parts or substitution also doesn't seem to be of great help.  The major problem is that there is a function $\psi$ inside the integral about which we don't know really anything apart from the fact that it is $C^\infty$ and with compact support.  How can we compute this integral and in the end show that the sequence $(\phi_n)$ is a delta sequence?  Just to make clear, I'm here doing all of this in the context of the Riemann integral. Given an infinite number of monkeys and an infinite amount of time, would one of them write Hamlet? Of course, we've all heard the colloquialism "If a bunch of monkeys pound on a typewriter, eventually one of them will write Hamlet."  I have a (not very mathematically intelligent) friend who presented it as if it were a mathematical fact, which got me thinking... Is this really true?  Of course, I've learned that dealing with infinity can be tricky, but my intuition says that time is countably infinite while the number of works the monkeys could produce is uncountably infinite.  Therefore, it isn't necessarily given that the monkeys would write Hamlet.  Could someone who's better at this kind of math than me tell me if this is correct?  Or is there more to it than I'm thinking? How do I change the Google Play country? Can someone tell me how to change the country preference for Google Play? I have searched high and low but in most of the forums people ask you to go to Gmail settings -> edit profile and change the country there. But there is no place to change the country in settings! There is a something called place (which can be marked as current) but that has no impact on Google Play.  I don't want to circumvent country restrictions, I want to permanently change the country. So it's NOT a duplicate of .