I was just playing around with python, take this code:  a=[[-1,-1,-1],[-1,-1,-1],[-1,-1,-1]] b=[[-1]*3]*3 print(a) print(b) a[0][0]=6 b[0][0]=6 print(a) print(b)   As I would expected it, both lists most be the same at the end, but they don´t, it looks like doing [[-1]*3]*3 creates by reference the lists, you can see that all first values from the list are change On console:  [[-1, -1, -1], [-1, -1, -1], [-1, -1, -1]] [[-1, -1, -1], [-1, -1, -1], [-1, -1, -1]] [[6, -1, -1], [-1, -1, -1], [-1, -1, -1]] [[6, -1, -1], [6, -1, -1], [6, -1, -1]]   is it a bug or is it just a normal behaviour? I'm using python 3.7
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?
I know the past tense carries the past tense in every dependent clause, but referring specifically to places or to things that are eternal, like the Earth, seems a bit weird and therefore we sometimes (I believe incorrectly) say     He didn't know that New Jersey was actually on the East Coast.   Because it still is. Or     He thought the Earth was round.   So is it square now?  Logically speaking, would you consider the use of past tense here a bit confusing in a day-to-day speech in these examples? Would you instinctively opt for using the present tense? For example, on Debian or Ubuntu, which package has the /sbin/shutdown command in it? I want to read the source of that command (and possibly modify it to report notification on desktop) and I didn't know which package source to download. How to clear the interpreter console? Like most Python developers, I typically keep a console window open with the Python interpreter running to test commands, dir() stuff, help() stuff, etc.  Like any console, after a while the visible backlog of past commands and prints gets to be cluttered, and sometimes confusing when re-running the same command several times.  I'm wondering if, and how, to clear the Python interpreter console.  I've heard about doing a system call and either calling cls on Windows or clear on Linux, but I was hoping there was something I could command the interpreter itself to do.  Note: I'm running on Windows, so Ctrl+L doesn't work. OpenGL GLX context is not using direct rendering, which may cause performance problems. (steam) AMD DRIVER When I start steam in a terminal, I get the following error messages   charlie@SteamMPL:~$ steam rm: no se puede borrar «/home/charlie/.steam/steam»: Es un directorio rm: no se puede borrar «/home/charlie/.steam/bin»: Es un directorio Running Steam on ubuntu 14.04 64-bit STEAM_RUNTIME is enabled automatically [2014-08-03 11:50:13] Startup - updater built Jul 15 2014 18:14:26 Installing breakpad exception handler for appid(steam)/version(1405474565_client) libGL error: failed to load driver: swrast Looks like steam didn't shutdown cleanly, scheduling immediate update check Installing breakpad exception handler for appid(steam)/version(1405474565_client) [2014-08-03 11:50:14] Checking for update on startup [2014-08-03 11:50:14] Buscando actualizaciones disponibles... Installing breakpad exception handler for appid(steam)/version(1405474565_client) [2014-08-03 11:50:14] Download skipped: /client/steam_client_ubuntu12 version 1405474565, installed version 1405474565 [2014-08-03 11:50:14] Nothing to do [2014-08-03 11:50:14] Verificando instalación... [2014-08-03 11:50:14] Performing checksum verification of executable files [2014-08-03 11:50:15] Verification complete Gtk-Message: Failed to load module "overlay-scrollbar" Gtk-Message: Failed to load module "unity-gtk-module" Installing breakpad exception handler for appid(steam)/version(1405474565_client) Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 70: non-double matrix element Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 70: non-double matrix element Fontconfig warning: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 78: saw unknown, expected number [0803/115015:WARNING:proxy_service.cc(958)] PAC support disabled because there is no system implementation libGL error: failed to load driver: swrast Error: OpenGL GLX context is not using direct rendering, which may cause performance problems.   Hardware information:   CPU: AMD Athlon x4 760k  GPU: AMD Radeon R7 250 1 GB GDDR5 (Driver: Catalyst 14.4) RAM: 8 GB DDR3 1600   What can I do to circumvent this issue? Cleaning small block of code (Switch, Case, If?) How should I invest my money as a young graduate in Europe? This is related to this , but that question's answers are 95% tailored for residents of the US, basically recommending to full out the 401k retirement plan and this and that about stock market investments. My question is, are there other types of investments that are good for a young person starting out a career? Pointers:  I live in a welfare state in Europe, so I don't have college debt, (debt of any kind actually). Rainy day funds are much less needed than in the US, since here there is unemployment insurance for at least 18 months. I can probably invest 500€-600€ monthly for something. (The question is what.) I am not looking to invest in my retirement (I am already forced to pay for that out of my salary). I want to maximize my earnings for medium term (5-15 years). I specially want to avoid the typical paradox of (be poor in your 20's,30's,40's and be able to use your money after your 50's). That is not an option for me, I want to use my money for X or Y. But the money used has to be earned from an investment. That is a general rule for me.  For example I want to earn from my investments at least 70k€ after 5-10 years. So I'm guessing this would be a high risk investment, correct? I would like to spend on travel, on courses, on sports etc... But I insist that the money I spend should be a result of an investment not from my salary. Additionally I am not looking to buy a house so I don't want a mortgage. Except if this would constitute a good investment? FYI: this applies to France. But I'd like a general answer so others can benefit. If the question is unclear, a duplicate or off-topic don't hesitate to comment Determine value of the limit:  $$L=\lim_{n\to \infty}\sqrt[n]{1^2+2^2+\cdots+n^2}$$  My try:  $$1^2+2^2+\cdots+n^2=\frac{n(n+1)(2n+1)}{6}$$  Hence: $$L=\lim_{n\to \infty} \sqrt[n]{\frac{n(n+1)(2n+1)}{6}}=?$$  But, come here, i do not know how, because please help me. How does Fermat's principle make light choose a straight path over a short path? This is a thought experiment where I have made a &quot;C&quot; shaped hole inside diamond. The refractive index $(\mu)$ of diamond is 2.45. Say we shine a laser from top of the &quot;C&quot; as shown. My calculations show that light reaching A can reach B in the least possible time if gone through the &quot;C&quot;. but I'm pretty sure the perpendicular laser beam travels undeflected and straight down. Though I don't have experimental evidence, I see something wrong either with my intuition or with the theory. It would be great if someone could clarify. *       'a' in the diagram is the thickness of the cutout and all comparable distances can be taken 'a'. I'm looking for a good, consistent and easy way to do a report of sudoers permissions for every user and group on the system. For users, I want the report to include permissions granted via group membership. is a light side power that many Jedi, including  are capable of. In Episode I, Qui-Gon uses it twice (once to outrun droids and once on Jar Jar's tongue), Obi-Wan uses it once and Anakin uses high speed reflexes for the entire duration of the pod race with no formal training.  According to  the power has a high drain and requires a longer recovery period than other powers. And then of course there are hilarious drawbacks such as .  But why wasn't this power used in the following scenarios (and many, many others):   The Redshirt Jedi who accompanied Windu to arrest Palpatine, before they were summarily dispatched to the Nether. Qui-Gonn, to avoid a lightsaber through his gut. Yoda, to avoid flying senate seats. By Windu, who is supposedly a notable practitioner. When I log in with LightDM on my laptop running Debian Unstable, it recently started to hang for around 2 minutes until journalctl shows the message kernel: random: crng init done. When I press random keys on my keyboard while it hangs, it logs in faster (around 10 seconds). Before I didn't have this issue, is there any way I can fix it?  Edit: using linux-image-4.15.0-3-amd64 instead of linux-image-4.16.0-1-amd64 works, but I don't want to use an older kernel. Why does the Stern–Gerlach quantum spin experiment conflict with classical mechanics? My understanding of the Stern–Gerlach experiment is that neutral (0 total charge) particles are sent through a non-homogeneous magnetic field, with the expectation that the field will push that particle's path higher or lower on a detector because of the collective spin of that particle. While the detector can detect particles in a two-dimensional surface, the results of the experiment are that particles appear in only two localized areas directly above the path of the particle stream, or directly below the path of the particle stream - spin up or spin down. The conclusions from these measurements are that the particle, when measured, will always have about the same magnitude.  Why does this not follow from classical mechanical theory related to magnetism? If you shot a magnet through a similar apparatus, I would expect the magnet to be rotated to align with the magnetic field in some way which, at high enough field strengths relative to the mass of the magnet, would cause us to measure basically the same magnitude as if the magnet entered the apparatus pre-aligned with the field.  How is my explanation incorrect? Why is the gradient of implicit surface the normal vector (i.e. parallel to the normal line)? If we have an implicit surface $g(x, y, z)=...$, the gradient is a normal vector. But why? Do I have to start with tangent vectors and then show the gradient is perpendicular? Not sure how to approach this. The  (ESC), states that for every natural number $n \geq 2$, there exists a set of natural numbers $a, b, c$ , such that the following equation is satisfied:  $$\frac{4}{n}=\frac{1}{a}+\frac{1}{b}+\frac{1}{c}\tag{1}$$  The basic approach to solving this problem outlined by Mordell [Ref1] is described below  By defining $t$ and $m$ as positive integers greater than zero and $q$ a positive integer greater than one we can observe that  a) There is always a solution for even $n$, since if $n=2^qt$ we have the trivial solution $$\frac{4}{4t}=\frac{1}{t}$$  In the remaining case $n=2(2t+1)$, a solution in the form of two Egyptian fractions can always be found  e.g. $$\frac{4}{2(2t+1)}=\frac{2}{2t+1}=\frac{1}{t+1}+\frac{1}{(t+1)(2t+1)}$$  b) If $(1)$ is a solution for some particular prime $n$ then all composite numbers $mn$ divisible by $n$ are also solutions, thus  $$\frac{4}{mn}=\frac{1}{ma}+\frac{1}{mb}+\frac{1}{mc}$$  will also be a solution. This means that we can simplify the analysis to the cases where $n$ is a prime greater than 2.  Using Mordell's approach we have just shown that we only need to consider the cases where $n$ is prime and where $n \equiv 1 \pmod{2} \;\;[meaning \;\;n=2t+1]$  The argument continues...  Mordell goes on to show in turn that the search can be reduced further to the cases when $$n \equiv 1 \pmod{4} \;\;[meaning \;numbers \;\;n=4t+1]$$ $$n \equiv 1 \pmod{8} \;\;[meaning \;numbers \;\;n=8t+1]$$ $$n \equiv 1 \pmod{3} \;\;[meaning \;numbers \;\;n=3t+1]$$ $$n \equiv 1,2,4 \pmod{7} \;\;[meaning \;numbers \;\;n=7t+1,n=7t+2 \;or\;n=7t+4 ]$$ $$n \equiv 1,4 \pmod{5}  \;\;[meaning \;numbers \;\; n=5t+1 \;or\;n=5t+4]$$  Assembling these results together, Mordell showed that the conjecture can be proved in this context except for the cases when $$n \equiv 1,11^2,13^2,17^2,19^2,23^2 \pmod{840}$$  Mordell stated that since the first prime meeting this condition is 1009, this is proof that the conjecture holds for $n&lt;1009$.  This basic approach can be pursued further. Other workers have shown that the conjecture holds for much higher values of $n$ using similar methods as can be seen on the above Wikipedia page.   Note that other intermediate results can be constructed from the above congruence's, e.g. $n \equiv 1 \pmod{24}$.  The question is:  Are there any other elementary approaches to solving this problem than the one outlined by Mordell (and described above)?  [Ref1] Louis J. Mordell (1969) Diophantine Equations, Academic Press, London, pp. 287-290. How does passive perception work Total noob question, but the passive perception is confusing. I don't understand how to calculate it or use it, and I need help. How to jump to the region header from the endregion tag in c# visual studio 2012? Footnote in tabular environment How do I get a file extension in PHP? This is a question you can read everywhere on the web with various answers:  $ext = end(explode('.', $filename)); $ext = substr(strrchr($filename, '.'), 1); $ext = substr($filename, strrpos($filename, '.') + 1); $ext = preg_replace('/^.*\.([^.]+)$/D', '$1', $filename);  $exts = split("[/\\.]", $filename); $n    = count($exts)-1; $ext  = $exts[$n];   etc.  However, there is always "the best way" and it should be on Stack Overflow. Do file-extensions have any purpose (for the operating system)? What is the opposite of "parallel" in architecture? The two towers of the Verrazano Bridge are not parallel: they are slightly [???] to account for the curvature of the earth.    What is that word?