I created list of lists in python by 3 methods. When I changed any element of list, All corresponding elements of each row were changed by using method 1 and 2 for list creation. What is actually happening in method 1 and 2?  method 1:  &gt;&gt;&gt; a = [['_']*3]*3 &gt;&gt;&gt; a [['_', '_', '_'], ['_', '_', '_'], ['_', '_', '_']] &gt;&gt;&gt; a[1][1] = 1 &gt;&gt;&gt; a [['_', 1, '_'], ['_', 1, '_'], ['_', 1, '_']]   method 2:  &gt;&gt;&gt; row = ['_']*3    &gt;&gt;&gt; board = [] &gt;&gt;&gt; for i in range (3): ...     board.append(row) ...  &gt;&gt;&gt; board [['_', '_', '_'], ['_', '_', '_'], ['_', '_', '_']] &gt;&gt;&gt; board[1][1] = 1 &gt;&gt;&gt; board [['_', 1, '_'], ['_', 1, '_'], ['_', 1, '_']]   while doing with list comprehension works:  &gt;&gt;&gt; arr = [['_' for i in range(3)] for i in range(3)] &gt;&gt;&gt; arr [['_', '_', '_'], ['_', '_', '_'], ['_', '_', '_']] &gt;&gt;&gt; arr[1][1] = 1 &gt;&gt;&gt; arr [['_', '_', '_'], ['_', 1, '_'], ['_', '_', '_']] &gt;&gt;&gt;
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?
Let There Be Light Story Identification I am looking to identify a story that I read around 2001 (it is probably much older).  Someone showed me the story on pages printed from the internet, and it was attributed to Isaac Asimov (although I cannot state that is the true author).    The story is told in glimpses at different points of time in the future.  In each glimpse, humans are asking a more and more "intelligent" computer how to prevent the universe from collapsing into a singularity in the future, and the computer states it needs more computational power and resources to solve this problem.  At some point, man becomes one with the computer, and the computer exists in hyperspace (or subspace?).    In the final glimpse, it is the end of time and the universe is collapsing into a singularity.  At the instant the universe reaches the singularity, the computer figures out how to prevent it and says "Let there be light" and the universe begins to expand again.  Is anyone familiar with this story? Defender of the Realm hat broken, or just badly worded? Description of the hat unlock requirement:     at least 5 flags dismissed as helpful and at most 20% of non-disputed flags declined   Does "dismissed" mean something unusual here, or is this hat not unlocking properly? I'm not sure if that means "since winter bash started" or "since your account was created": if the former, I've flagged 8 items so far today, of which 6 were marked "helpful" (the other two are still active; none have been disputed or declined). If the latter, the flag page indicates I've flagged 391 items (plus 6 for spam), of which 1 was declined (which incidentally, I assume that was by accident, given that the question was closed soon after for the reason I flagged it for), 1 was disputed (that one was legitimate), and 21 are still open. That is definitely way under 20%.  So what's up with that unlock?  edit: it appears to be the case (further edit: this has now been confirmed first-hand) that this hat unlock disregards any flags that are the flag equivalent of voting to close. I put forth that if this is intended behavior, well, it shouldn't be (if it's to equalize the playing field for over-3k-rep people, it should just also count votes-to-close. Though granted, I suppose in the scheme of things it really doesn't matter much, as it'll all go away in a couple weeks anyway. But dang it, I want to show off all the flagging I do! :p) optimality of the Carnot cycle It is well-known and is stated always and everywhere that the Carnot cycle is the most efficient thermodynamic cycle. Although stated as such it is rarely proven. One proof is in the article &quot;Engine Efficiencies and the Second Law of Thermodynamics&quot;, (AMERICAN JOURNAL OF PHYSICS VOLUME 37, NUMBER 11 NOVEMBER 1969), Tobin proves that among all engines performing a cycle, so that the engine returns to its starting state, the Carnot cycle is the most efficient where efficiency is defined as $\epsilon= 1-\frac{Q_{rejected}}{Q_{absorbed}}$, and the Carnot cycle is defined as one consisting of an isothermal-adiabatic-isothermal-adiabatic segment. The proof assumes the Clausius equality, that is in a reversible cycle $\oint \frac{\delta Q}{T} = 0$. Then using the geometry of the picture below a simple argument over the areas enclosed in the cycles IABCDJI vs. IAEFGDJI (heat absorbed) or IJDAI vs. GHEAIJDG (heat rejected) will show that any other cycle working between the same temperature limits such as EFGHE will have lower efficiency than the Carnot cycle ABCDA. But this proof assumes tacitly that pieces EFG and GHE are such that $dS&gt;0$ and $dS&lt;0$, respectively. Here I am thinking of a nasty cycle such as shown in the next figure in red where the cycle cannot be neatly separated into two and only two monotonic parts having $dS&gt;0$ or $dS&lt;0$. There is no obvious reason why that restriction should hold in general. Clearly this monotonicity should hold if the engine has only temperature as its independent &quot;force&quot; but if the engine's state needs more than one independent force variable than the situation is more complicated. Instead it is reasonable to assume that any physical cycle should have finite number of monotonic pieces, kind of a &quot;thermodynamic Dirichlet condition&quot; but it could also have self intersections, little loops, and other ugly features when projected on the TS plane. How would then one prove the optimality of a Carnot cycle? Or ugly cycles on the ST plane are non-physical even if there are more than one thermodynamic variables? [] [] resizing a BUTTON through CSS Typesetting linguistic rewrite rule I'm trying to (more or less) replicate this phonological rewrite rule:    I'm using the package , and what I manage to accomplish is this:  \documentclass{article} \usepackage{phonrule} \begin{document}  \phonc     {\phonfeat{$-$cnt\\ +hi}}     {[$\alpha$grv]}     {\oneof{%         \phonfeat{$-$cnt\\ $\alpha$grv}\phold\\         \phold\phonfeat{$-$cnt\\ $\alpha$vce}%     }}  \end{document}     My main problem here is what appears after the "when" slash:  (1) The package only provides a left curly bracket - how can I add a right one as well?  (2) The two options within the curly brackets are not well aligned. I think comparing the two pictures themselves says it better than what I could do with words. a) Determine the number of ways to colour a 1 by n grid using the colours red and white if an even number of squares are to be coloured red.   Note that n is greater than or equal to 1 and the number of red squares could be 0.  I know I must consider the cases of n being even and odd, and determine the sum, from zero to n of the squares being red, where the number of red squares is even. But I just want to make sure I haven’t missed any arrangements by saying a) is $2^{n-1}$ when n is even and $2^{n-1}-1$ when n is odd.  b) Determine the number of ways to colour the squares using red, white and blue if an even number of squares are to be coloured red.  For this case, I can have arrangements including red only, white only, blue only, white and blue only, red and white only, red and blue only, and finally all three colours.  Thank you for any help provided. how to place JS-code to NewForm.aspx of a list in SharePoint 2013 APP.  In sharepoint 2010 we can use this list definition to add JS:  &lt;List ...&gt;   &lt;MetaData&gt;     ...     &lt;Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" UseDefaultListFormWebPart="False"&gt;         &lt;WebParts&gt;           &lt;AllUsersWebPart WebPartZoneID="Main" WebPartOrder="1"&gt;             &lt;![CDATA[              &lt;WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"                 xmlns:sfwp="http://schemas.microsoft.com/WebPart/v2/SimpleForm"&gt;               &lt;Assembly&gt;Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&lt;/Assembly&gt;                                        &lt;TypeName&gt;Microsoft.SharePoint.WebPartPages.SimpleFormWebPart&lt;/TypeName&gt;               &lt;FrameType&gt;None&lt;/FrameType&gt;               &lt;Title&gt;JS1&lt;/Title&gt;               &lt;sfwp:Content&gt;ANY HTML YOU NEED HERE               &lt;/sfwp:Content&gt;             &lt;/WebPart&gt;             ]]&gt;           &lt;/AllUsersWebPart&gt;           &lt;AllUsersWebPart WebPartZoneID="Main" WebPartOrder="2"&gt;             &lt;![CDATA[             &lt;WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"&gt;               &lt;Assembly&gt;Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&lt;/Assembly&gt;                                        &lt;TypeName&gt;Microsoft.SharePoint.WebPartPages.ListFormWebPart&lt;/TypeName&gt;               &lt;PageType&gt;PAGE_NEWFORM&lt;/PageType&gt;             &lt;/WebPart&gt;             ]]&gt;           &lt;/AllUsersWebPart&gt;         &lt;/WebParts&gt;       &lt;/Form&gt;     &lt;/Forms&gt;   &lt;/MetaData&gt; &lt;/List&gt;   How to do the same for Sharepoint 2013? Avoiding numerical cancellation question for $\sin x -\sin y$ for $x \approx y$ When trying to avoid cancellation, one tries to reformulate the equation in order to avoid subtraction between almost equal terms.   In $\sin (x) - \sin (y), x \approx y$ the suggested solution is to reformulate it to $$2\cos\left(\frac{x+y}{2}\right)\sin\left(\frac{x-y}{2}\right)$$  But I don't understand how it is any better? The subtraction between $x, y$ remains. Is it because $\lvert\,\sin(x)-\sin(y)\,\rvert\leq \lvert\,x-y\,\rvert$, so cancellation is less likely to happen between $x,y$ than the sines? Is three hours enough for an international-domestic transfer at Delhi? My International flight will be reaching New Delhi IGI at 2:45 AM and I am planning to book a domestic flight at 5:45 AM.  Is three hours sufficient for me to move from International to Domestic?  I believe there must be a shuttle service inside the airport to transfer me from International to Domestic but still I don't know if Customs time at IGI could cause any delay or not. How can I undo git reset --hard HEAD~1? Is it possible to undo the changes caused by the following command? If so, how?  git reset --hard HEAD~1 Determining if an arbitrary point lies inside a triangle defined by three points? Is there an algorithm available to determine if a point P lies inside a triangle ABC defined as three points A, B, and C? (The three line segments of the triangle can be determined as well as the centroid if they are needed.)  Grid space is defined as Screen Space, that is, 2D Cartesian with the Y-Axis flipped so "up" is negative y and the origin is the upper left corner. How can I switch between starting a coroutine vs running the routine all at once? The limit of a convergent Gaussian random variable sequence is still a Gaussian random variable I'm trying to prove this conclusion but have some problems with one of the steps.  Assume $X_1,\ldots,X_n,\ldots$ is a sequence of Gaussian random variables, converging almost surely to $X$, prove that $X$ is Gaussian.  We use characteristics function here. Since $|\phi_{X_n}(t)|\leq 1$, by dominated convergent theorem, we have for any $t$  $$ \lim_{n\rightarrow\infty}e^{it\mu_n-t^2\sigma_n^2/2}=\lim_{n\rightarrow \infty}\phi_{X_n}(t) = \lim_{n\rightarrow \infty}\mathbb{E}\left[e^{itX_n}\right] = \mathbb{E}\left[e^{itX}\right] = \phi_X(t) $$  this is the step that I cannot figure out: $e^{it\mu_n-t^2\sigma_n^2/2}$ converges for any $t$ if and only if $\mu_n$ and $\sigma_n$ converges.   Let $\mu=\lim_n \mu_n$, and $\sigma=\lim_n\sigma_n$, then $\phi_X(t)=e^{it\mu-t^2\sigma^2/2}$, which proves that $X$ is a Gaussian random variable.  Why can we get that $\mu_n$ and $\sigma_n$ converge? This looks intuitive for me, but I cannot make a rigorous prove. We often get questions on bicycles.stackexchange about fitting wider or narrower tires to bicycles. We have a large number of these with answers suiting the specific bike or style of bicycle in question, but I have been unable to find one that provides a generic answer covering off all things that need to be considered. For most bicycles, the answer is the same regardless of the specific style and sizes of tires in question.   This is intended as a canonical question that we can point closed questions to. I prefer to use bm package to bold math. However, I noticed that when used with eulervm, this gives inconsistent results for ‘&lt;’ and ‘>’ characters.  I wonder what causes it and can the usage bm be fixed to get proper ‘&lt;’.  \documentclass{article}  \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc}  %\usepackage{amsmath}  \usepackage[euler-digits,euler-hat-accent]{eulervm}  \usepackage{bm}  \begin{document}      \texttt{\hphantom{mathbold}\llap{bm}}: \quad $ 1 + 1 &lt; 3; \quad \bm{1 + 1 &lt; 3} $      \texttt{mathbold}: \quad $ 1 + 1 &lt; 3; \quad \mathbold{1 + 1 &lt; 3} $  \end{document} asp.net mvc put controllers into a separate project I'm just learning asp.net mvc and I'm trying to figure out how to move my controllers into a separate project.  Typically when I have designed asp.net web apps before, I created one project for my models, another for my logic, and then there was the web.    Now that I'm learning asp.net mvc I was hoping to follow a similar pattern and put the models and controllers each into their own separate projects, and just leave the views/scripts/css in the web.  The models part was easy, but what I don't understand is how to make my controllers in a separate project be "found".  Also, I would like to know if this is advisable.  Thanks! stl::multimap - how do i get groups of data? Multimap essentially has groups of data sorted by the key. I want a method by which I could access these individual groups and get their aggregate values. For example, in a std::multimap&lt; string, int &gt; I store   {"Group1", 1},  {"Group1", 2},  {"Group1", 3},   {"Group2", 10},  {"Group2", 11},  {"Group2", 12}   Having stored these values, I should be able to iterate this multimap and get the aggregate values of each "group". Problem is there aren't any functions defined in STL to access MultiMaps in such a way. I could use lower_bound, upper_bound to manually iterate the multimap and total the group's contents, but I am hoping there could be better ways already defined in STL ? Can anyone propose a solution as to how I could get the aggregate values for a group in the above example. Uniform convergence of $\sum\limits_{k=1}^{\infty}\dfrac{kf(x^2)}{1+k^3f(x^2)^2}$ Prove $-(-a)=a$ using only ordered field axioms How to use testfor with a mob with a two-word name? How can I test for mob who has a name with two words? For example villager named Grumpy Bill. For example I want to kill this villager.  This command   /kill @e[name=Bill]   would work just fine but when I try  /kill @e[name=Grumpy Bill]   it says "The entity UUID provided is in an invalid format"  What is the proper command for this action?