list= []  x = ['A', 'B', 'C', 'D', 'E', 'F', 'G']  for i in range(2):            list.append(x)  list[0][0]="x"  print list   And after printing I get this:  [['x', 'B', 'C', 'D', 'E', 'F', 'G'], ['x', 'B', 'C', 'D', 'E', 'F', 'G']]   The first item in every list was replaced by 'x' whereas I only wanted the first item in the first list to be replaced by 'x'(hence the line list[0][0]="x")
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?
If parsing the output of ls is dangerous because it can break on some funky characters (spaces, \n, ... ), what's the best way to know the number of files in a directory?  I usualy rely on find to avoid this parsing, but similarly, find mydir | wc -l will break for the same reasons.  I'm working on Solaris right now, but I'm looking for a answer as portable across different unices and different shells as possible. Consider a block cipher with a key of size 128 bits but a small block size, say 32 bits.  Is this kind of block cipher secure?  I would like to know to what extent I can use a small block cipher, like a 32 bit block cipher. What are the constraints so that the use is acceptable in a real life application.  For instance, if we use a one-time key, that is, to encrypt only one message. Besides, the message could be small.  Suppose that when we want so send one file, we perform a key agreement so that we use the key for one message. This scenario is not efficient, but the CPA find-then-guess game is not adequate in this case. I'm a completely new user of Linux and since my computer is not a good machine I wanted to install 32 bit OS, I downloaded ubuntu desktop for 32 bit but when I check in system settings under details it says my OS type is 64 bit, I downloaded it from the site  choose Ubuntu 12.04 LTS and set it as 32-bit (machines with less than 2GB RAM). How to set system-wide environment variables on OS X Mavericks I've noticed an interesting phenomenon in the user interfaces of many famous applications, they're moving away from the glossy complex to a more dull and bare minimum design.  Why the sudden change? It also appears that most of these companies have adopted this design around the same time, was that linked to some new study?  Examples: Why would a JavaScript variable start with a dollar sign? I quite often see JavaScript with variables that start with a dollar sign. When/why would you choose to prefix a variable in this way?  (I'm not asking about $('p.foo') syntax that you see in jQuery and others, but normal variables like $name and $order) I thought the new Apple font was called San Francisco, but I cannot find it in the font list of the Keynote.app for my Mac. Is it called another way or it is not available for Keynote?  I am currently using OS X El Capitan. Order discrete x scale by frequency/value Cannot empty trash I am trying to empty my trash, and it keeps giving me an error message that says,      .Trash can't be opened right now because it's being used by another task...     I have tried restarting my computer, running Finder > Secure Empty Trash everything yields the same result and error message from above. Let $A,B \in \mathbb{M}_n (\mathbb{C})$. If $A^2B + BA^2 = 2ABA$ then exist $k \in \mathbb{N}$ where $(AB-BA)^k = 0$.  I tried solve with minimal polynomial, but I did not have much effect. How can one show there is no holomorphic function $f$ on the open unit disc $\mathbb{D}$ such that it extends continuously to $\frac{1}{z}$ on $\partial\mathbb{D}$? I mean $f$ takes value $\frac{1}{z}$ when $|z|=1$ and continuous here.  Thank you. What should happen if a logo I made is similar to another? Note: This is a canonical post created so that we can close the many similar questions as duplicates as discussed in .   We have created a logo for a client and they love it. We've already started preparing the materials that will feature the new logo.   However, after we had created the logo, we found a logo for another company that looks eerily similar. We did not intentionally create the new logo to look like the one of the other company, in fact we didn't even know it existed beforehand, but it does regardless.  What should we do? Is this plagiarism? Can our client use the logo we have created? Should they? Or do we need to come up with another logo that's more different? If a lightning-radio-group has two options, and a user selects one, I want to programmatically have the UI changed back to the other one.  Link to a . (code copied below)  import { LightningElement, track } from 'lwc';  export default class RadioGroupRequired extends LightningElement {     @track value = 'option1';      get options() {         return [             { label: 'Option one', value: 'option1' },             { label: 'Option two', value: 'option2' },         ];     }      handleOnChange(evt) {         this.value = 'option1';         // how to make the UI select Option one?     } }   And the html:  &lt;template&gt;     &lt;lightning-radio-group name="radioGroup"                            label="Radio Group"                            options={options}                            value={value}                            required                            type="button"                            onchange={handleOnChange}&gt;&lt;/lightning-radio-group&gt;                             value={value} &lt;/template&gt;     I think that there is no rerendering because the bind variable, {value} doesn't actually change. However, the selected state of the lightning-radio-group does, and I want to be able to change it back. How can that be achieved?   I did not notice any methods or attributes that would seem to do the trick in the . What is the "wheel" user in OS X? Does anyone have an intuitive explanation of why this is the case? Should I change the URLs in the XML sitemap after 301 redirecting them? I am using 301 redirects for all URLs.  Should I change sitemap URLs now?  The sitemap currently contains the following URLs:   example.com/cat/1.html example.com/cat/2.html example.com/cat/3.html   Should I change the sitemap's URLs to a new destination?   example.com/cat/year/1.html example.com/cat/year/2.html example.com/cat/year/3.html What's the difference between Google Chrome and/or Chromium? What are the advantages/disadvantages to each? I used Google Chrome in Windows, and am now using Chromium in Ubuntu.  Is there any difference to the two programs?  What are the advantages and disadvantages to each program?  Which one seems better? Show for prime numbers of the form $p=4n+1$,  $x=(2n)!$ solves the congruence $x^2\equiv-1 \pmod p$. $p$ is therefore not a gaussian prime. I need to show that for prime numbers of the form $p=4n+1$, $x=(2n)!$ solves the congruence $x^2 \equiv-1\pmod p$. I then need to show this implies p isn't a gaussian prime.   I have started to solve this using Wilson's theorem that a number $z$ is prime iff $(z-1)!\equiv-1\pmod z$. Therefore the endpoint of my proof should be that $(p-1)!\equiv-1\pmod p$.  As $p$ is of the form $p=4n+1$, I only need to prove that $4n!$ is congruent to $-1$ modulo $p$.   Here is my working so far: Starting with the congruence $x^2 \equiv -1\pmod p$:    $$\eqalign{x^2 = -1\pmod p&amp;\implies   x^2 + 1 = kp \implies (x-i)(x+i) = kp\cr &amp;\implies ((2n)!-i)((2n!)+i))=kp \implies 4n!- 1 =kp\cr}$$   This is where I start to run out of any ideas that seem to get me anywhere. Any tips would be greatly appreciated! Why does a lightsaber turn off when a Jedi dies or drops it? I rewatched the three newer movies and noticed that whenever a Jedi was killed, or let go of their lightsaber, it immediately turned off.  What was curious was that the lightsaber turns off right away, when a Jedi is killed, even before it leaves their hand (if it does fall out).  I could understand if the button needs to be held for it to stay on, but when a Jedi is shot and is still holding the lightsaber why would it turn off? Why do Windows 10 foreground apps mysteriously launch as background processes?