example code:  my_list = [[]] * 4 my_list[2].append(3) print my_list   expected: [[], [], [3], []]  actual: [[3], [3], [3], [3]]  My inference is that the nested lists are copies of one another. Is there a way to achieve the expected?
I needed to create a list of lists in Python, so I typed the following: my_list = [[1] * 4] * 3  The list looked like this: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]    Then I changed one of the innermost values: my_list[0][0] = 5  Now my list looks like this: [[5, 1, 1, 1], [5, 1, 1, 1], [5, 1, 1, 1]]    which is not what I wanted or expected. Can someone please explain what's going on, and how to get around it?
Show community wikis differently in the Android app I was trying to concatenate text files in sub-folders and tried:  cat ./{mainfolder1,mainfolder2,mainfolder3}/{subfolder1}/book.txt &gt; out$var   However this did not return anything. So, tried adding a non existing 'subfolder2'  cat ./{mainfolder1,mainfolder2,mainfolder3}/{subfolder1,subfolder2}/book.txt &gt; out$var   And this time it did work out, concatenating the files successfully. Why does this happens? Another domain name pointing to my server IP? I was checking out my reverse-DNS entry of my domain the other day which is run from a dedicated server.   I noticed that another person/company had their domain pointing to my server? I have no idea who this company is or why they are pointing their domain at my server IP?  How can I go about stopping this or forcing them to change? Adding more than 15 digits in Excel Some ships in Star Trek are referred to with definite articles. "The Enterprise", "The Defiant". Other ships are referred to without them. "Voyager", "Enterprise". Is there a pattern to or explanation for this behavior? Identify the plane defined by $|z-2i| = 2|z+3|$ I tried:  $$|z-2i| = 2|z+3| \Leftrightarrow \\ |x+yi-2i|=2|x+yi+2|\Leftrightarrow \\ \sqrt{x^2+(y-2)^2}=\sqrt{4((x+2)^2+y^2)} \Leftrightarrow \\ \sqrt{x^2+y^2-4y+4} = \sqrt{4x^2+24x+36+4y^2} \Leftrightarrow \\ x^2+y^2-4y+4 = 4x^2+24x+36+4y^2 \Leftrightarrow \\ y^2-4y-4y^2=4x^2+24x+36+x^2 \Leftrightarrow \\ -3y^2-4y=5x^2+24x+26 \Leftrightarrow \\ ???$$  What do I do next? How can I tell what year my bike was made? Getting polygon shapefile node coordinates and point order I want to prove that: $\ln(x+1)&lt; x$.  My idea is to define:  $f(x) = \ln(x+1) - x$, so:  $f'(x) = \dfrac1{1+x} - 1  = \dfrac{-x}{1+x} &lt; 0, \text{ for }x &gt;0$.  Which leads to $f(x)&lt;f(0)$, so $\ln (x+1)-x&lt;0$.  Is that a valid proof? Any other ideas?  Thanks. Can somebody help me understanding the fouries series coefficients?  I know that if we have:  $$f(t) = \sum_{n=1}^N A_n \sin(2\pi nt + Ph_n) \tag{where $Ph_n$ = phase}$$  And because of the $\sin(a+b)$ formula: $$ f(t) = \sin(2\pi nt + Ph) = \sin(2\pi nt )\cos(Ph_n) + \cos(2\pi nt )\sin(Ph_n)$$ Then:  $$\sum_{n=1}^N A_n \sin(2\pi nt + Ph) = \sum_{n=1}^N (A_n\sin(2\pi nt )\cos(Ph_n) + A_n\cos(2\pi nt )\sin(Ph_n))$$ And by definition: $$a_n = A_n\cos(Ph_n)$$ $$b_n = A_n\sin(Ph_n)$$ Then:  $$f(t) = \sum_{n=1}^N A_n \sin(2\pi nt + Ph) = \sum_{n=1}^N (a_n\sin(2\pi nt ) + b_n\cos(2\pi nt ))$$ Where does the $A_n$ in the first formula come from? Could somebody explain me where does the $\frac{a_0}{2}$ in the formula below come from? $$f(x) = \frac{a_0}{2}+\sum_{n=1}^\infty (a_n \cos(nx) + b_n \sin(nx))$$  And the most important:  How can I proof the formulas for the $a_n$ and $b_n$ coefficients?  PLEASE, I'm searchinf for these answers for DAYS. While rendering a mesh with smooth shading on, I get a dark region/shadow on certain faces. The effect is more evident when smooth shading is applied to a mesh containing ngons, with the ngons turning black when rendered.   The blackening effect is visible in the viewport too.  How can I solve this problem? In Texas Hold'em poker, there are some cases where a particular card, often called kicker, acts as a tiebreaker between players to determine who wins the pot, or if the pot has to be shared.  For some combinations such as three or four of a kind, there is no doubt: the kicker is the 5th card of the chosen combination, and determines the winner.  Example     Alice has 7 and 10   Bob has 7 and K   On the board are 7, 7, 2, 3, 4   In that case, both have a three of a kind. But because Bob has a king and Alice only a 10, he wins.  Most of poker websites explaining the rules clearly mention the role of the kicker applying to three of a kind and double pairs. But much fewer say something about colors, straights and full houses, and I found many contradicting answers. I also asked the question to some used online poker players and they also gave me contradicting answers.  I have tried to search for official tournament rules, but most of them only explain what happens with bad behaviors, bad deals, incorrect or confusing betting, showing cards when you shouldn't, acting when it's not your turn, etc. without mentioning subtleties about combinations at all.  To simplify my question, I will take three examples; I think it's better to start with examples before getting to the general answer if one exists. So, what's happening in the following 3 examples? Could you give a more generalized answer?  Example 1 - Flushes     Alice has 2&clubs; and 3&clubs;   Bob has 4&clubs; and 5&clubs;   On the board are 6&clubs;, 8&clubs;, 10&clubs;, 2&hearts;, 5&diams;   Contradicting answer 1: it's a tie, because the highest card included in the flush is the 10, which everybody chooses to include in their 5 showdown cards. Contradicting answer 2: Bob wins, because he has the greatest private card that is part of the flush  Example 2 - Straight     Alice has 6 and K   Bob has 6 and J   On the board are 4, 5, 7, 8, 10   Contradicting answer 1: it's a tie, because the greatest card in the straight is the 8 for both Alice and Bob Contradicting answer 2: Alice wins, because she owns an extra king, compared to the jack of Bob  Example 3 - Full house     Alice has 3 and 7   Bob has 3 and 6   On the board are 3, 3, 2, 2, 5   Contradicting answer 1: it's a tie, because one is supposed to choose only five cards to make a combination, and a full house is already five cards. There couldn't be any kicker, and thus their showdowns are strictly equals. Contradicting answer 2: Alice wins because of her extra 7, compared to the 6 of Bob  Thank you very much for your answers.  Note: I'm unable to post next to you, so I edit my own post; strange not be able to answer to an answer.  Ok, So if I summarize what you are saying :   In the flush case, Bob wins because at some point, their hand differs. Technically, I can continue comparing the highest private card to decide who wins. I had it correct. In the straight case, if the highest card of the straight is public, then it's technically always a tie, no matter what the players had as second private card (asuming that only one of the two cards was part of the straight). In a full house if both players have the same triplet and the same pair, it's always a tie, no matter what the players had as second private card (assuming again that only one of the two was part of the full house).   Please confirm me that what I summarized is correct.  Thank you for your answer. How to open and convert CHM documents? I have some documents that are in a .chm format. I wondered if there is a file format that can be easier to navigate, supported and of equal file size in Ubuntu?  If there is, I would like to start converting all those books and probably using them with less hassle on all my Ubuntu PCs and my Android phone. Finite ring has only zero divisors and units If a nonzero element $a$ of a ring $\mathbb{D}$ does not have a multiplicative inverse, then $a$ must be a zero divisor.   If $\mathbb{D}$ has finitely many elements, then the statement is true. However, I don't see why, as for the infinite case, 7 isn't a zero divisor only because every element $a &gt; 0$ when multiplied by a $b &gt; 0$ gives you $ab &gt; 0$ which has nothing to do with infinity or finite amounts of elements. Which is correct: "__ is different from __" or "__ is different than __"? As someone who learned English later on in life, I was taught that different from is the correct grammar to use: this is different from that. However, it seems these days everyone uses different than instead. I know it's incorrect usage, but does the language evolve if the majority wins?  Edit: Some commented different than is American English and different from is British English, both are OK. IMO, this isn't like color versus colour, though.   Than is used after a comparative adjective, e.g. taller than, whiter than. The word different isn't a comparative adjective, unless used in more different than. Logically, it makes no sense to say different than. My computer is loud: How do I tell which fan is the issue? On my new computer, my fan(s) is/are plain LOUD! Using SpeedFan, I find that my temps are all under 32 degrees C under my normal use (IDK how accurate that is but the CPU itself says 27 C).  The fan doesn't sound unbalanced and it isn't making sounds in rhythm (Not the usual rrrrrrrRRRRRR... rrrrrrrRRRRRR... rrrrrrrRRRRRR... rrrrrrrRRRRRR), just a constant fan. I am thinking about oiling the fans, but I can't decide if it is the PSU fan or a case fan or the CPU fan. If it's the CPU fan I will most likely just replace that with a quiet fan. How can I tell which fan is making the noise (if not multiple)?  One thing that I am thinking may be the problem is my CPU fan isn't PWM so would swapping that out help? There is no "linear voltage" or etc thing in BIOS so I think it may be running at full speed. Also, I could have too much airflow because it is also making a whistling noise that you can hear close to it that sounds like when I accedentially put part of the side cover over my floor vent to get it out of the way. Can the determinant of a matrix can be made $0$? An entry of an $n \times n$ matrix with nonzero determinant is defined as interesting if by changing this entry (and only this entry) the determinant of the matrix can be made $0$.   Is it true that each entry of every matrix with nonzero determinant is interesting? Is it true that there is an interesting entry in each row of a matrix with nonzero determinant? How can I change my VPN connection settings in Windows 7 from the command line?  I know how to do it using the GUI but I really need to do it from the console.  I need to change the user, password and internet address and then restart the connection. It doesn't matter if I have to install some third-party software in order to do this (from the command line). Finding the roots of complex numbers $(2i)^{1/2}$  $(1-\sqrt{3}i)^{1/2}$  $(-1)^{1/3}$  $(-16)^{1/4}$  How can I find the roots of the complex numbers above? It is a theorem in elementary number theory that if $p$ is a prime and congruent to 1 mod 4, then it is the sum of two squares. Apparently there is a trick involving arithmetic in the gaussian integers that lets you prove this quickly. Can anyone explain it?