The problem happens in the nested loop. In the first iteration everything is fine. The 2nd iteration over i, modifies the first list too and so on. Zeros across the 2d list should be diagonal   import math def calcpyth(p1, p2):     distance = math.sqrt(((p1[0] - p2[0]) ** 2) + ((p1[1] - p2[1]) ** 2))     return distance  tuple0 = (42, 288) tuple1 = (45, 326) tuple2 = (50, 364) tuple3 = (57, 400)  list = [tuple0, tuple1, tuple2, tuple3] zeros = [[0]*len(list)]*len(list) test = zeros  for i in range(len(test)):     for j in range(len(test)):         test[i][j] = calcpyth(list[i], list[j])
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?
What is the moment of a joint random variable? Simple question, yet surprisingly difficult to find an answer online.  I know that for a RV $X$, we define the kth moment as $$\int X^k \ d P = \int x^k f(x) \ dx$$ where the equality follows if $p = f \cdot m$, for a density $f$ and Lebesgue measure $m$.  So, what is the kth moment of, say, $(X,Y)$? $\int (X,Y) \ d P$ doesn't really seem like the answer to me.... if there are 4 different tables and 18 people, how many ways can the people be seated to have at least 4 in each table? For example with 15 people at 3 different tables each seating 5 people, is the number of combinations of seating equal to: $$\binom{15}5\binom{10}5(4!)^3$$ Why does HMAC use two different keys? Suppose $H$ is a hash function; why is $$H(k\mathbin\|H(k\mathbin\|m))$$ not secure?  See this . In there, indeed two keys are used and the mac algorithm is $$H(k_1\mathbin\|H(k_2\mathbin\|m)).$$ Why don't we use $$H(k\mathbin\|H(k\mathbin\|m)),$$ which has only one key? Can you deliver it [when,after] it [is | will be] assembled? Open the default browser in Ruby In Python, you can do this:  import webbrowser webbrowser.open_new("http://example.com/")   It will open the passed in url in the default browser  Is there a ruby equivalent? Custom cursor in WPF? I want to use an image or icon as a custom cursor in WPF app. What's the best way to do it? Prove that $n=\dfrac{5^{125}-1}{5^{25}-1}$ is a composite number   My attempt,  Let $x=5^{25}$, so that $5^{125}-1=x^5-1=(x-1)(x^4+x^3+x^2+x+1)$  $=(x^4+9x^2+1+6x^3+6x+2x^2-5x^3-10x^2-5x)(x-1)$  $=((x^2+3x+1)^2-5x(x+1)^2)(x-1)$  I'm stuck at this point and don't know how to continue anymore. Hope someone can provide a detailed solution. Thanks a lot. How can I encode and decode percent-encoded strings on the command line? Prove the existence of an analytic function Let $\Delta=\{z\in \mathbb C: |z| &lt; 1\}$. Let $f: \Delta \rightarrow \mathbb C$ be a one-to-one analytic function fixing the origin. Prove that there is a one-to-one analytic function $g: \Delta \rightarrow \mathbb C$ such that $[g(z)]^2=f(z^2)$. Further, show that such a function is odd.  The only idea which comes to my mind is the following (not sure whether it is the right direction though). Let $h: \Delta \rightarrow \Delta \rightarrow \mathbb C,\ z\mapsto z^2\mapsto f(z^2)$. Note that $h'(0)=0,\ h''(z)=2f'(z^2)+4z^3f''(z^2)$; since $f$ is one-to-one and analytic, its derivative never vanishes, so $h''(0)\ne 0$. So $h$ is an analytic function of $\Delta$ with a zero of order two at the origin. Then there is an analytic function $g$ defined in an open disc about the origin with a simple zero at the origin such that $[g(z)]^2=f(z^2)$.   This is the only thing I came up with, but it seems to be a little bit irrelevant since I don't see any way of extending this $g$ to the whole $\Delta$, and also the injectivity and oddness of such a $g$ are unclear. I occasionally update my kernel from this web site    I have been always downloading 3 deb files for installing  linux header all, linux image and linux headers. I noticed one more deb file recently for 64 bit kernel called Linux-image-extra.  I would like to know what does kernel file Linux-image-extra do and should I also install it? EEVEE and Cycles render lighting differences I get different lightning render with the same scene camera setup.  Cycles render (both experimental and supported feature set) gets weaker lightning and needs more energy.  How can I get the same lightning and reflection setup with EEVEE and Cycles? How to log commands within a "sudo su -"? If I:   [user@notebook ~] sudo echo 123456uu 123456uu [user@notebook ~]    Then I can see that in the logs:  [root@notebook /var/log] grep 123456uu * auth.log:Jan  9 17:01:51 notebook sudo: user : TTY=pts/3 ; PWD=/home/user ; USER=root ; COMMAND=/bin/echo 123456uu [root@notebook /var/log]    but if I:   [user@notebook ~] sudo su - [root@notebook ~] echo 1234567zz 1234567zz [root@notebook ~]    I cannot see it in the logs:   [root@notebook /var/log] grep 1234567zz * [root@notebook /var/log] echo $? 1 [root@notebook /var/log]    My question: How can I turn the logging on for the commands within the "sudo su -"?  OS is an Ubuntu 12.04 but the question is in general.   UPDATE#1:   [user@notebook ~] sudo su - [sudo] password for user:  [root@notebook ~] echo zizizi zizizi [root@notebook ~] cd /var/log [root@notebook /var/log] grep -iIR 'zizizi' * [root@notebook /var/log] grep 'COMMAND=/bin/su -' * auth.log:Jan 10 15:42:42 notebook sudo: user : TTY=pts/1 ; PWD=/home/user ; USER=root ; COMMAND=/bin/su - [root@notebook /var/log] Why Do Jedi Use One Lightsaber in Combat? While I've seen Ahsoko Tano, in The Clone Wars, fight with two lightsabers (one in each hand), this seems to be extremely rare for Jedi.  We've seen Sith do this frequently, like Asajj Ventress, with two lightsabers.  Darth Maul used a dual lightsaber against Qui-Gon Jinn and Obi-Wan Kenobi and then there's General Grievous, who uses multiple lightsabers with his multiple limbs.  But most Jedi use just one blade, and their lightsaber hilts tend to be simple, just a straight cylinder without much adornment, while Sith sometimes use curved grips or other more exotic stylings.  Is there a reason Jedi stick with the simplest lightsaber designs and why the vast majority (at least in the movies and in The Clone Wars series) use only a single lightsaber? Mod of numbers with large exponents [modular order reduction] Managing module library dependencies with composer I've found ,  and  which are releated to my question, but no longer seem to apply since Drupal 8.1 and the deprecation of .  Also popular guides such as  appear to no longer apply as they also mention composer manager.   The other solution opposed to composer manager, alter the core composer.json file feels like too much core hacking and would probably break with every Drush update of Drupal core(?).  More specifically, I am attempting to update  from Drupal 7 to 8. I have created my composer.json file as follows:  {   "name": "drupal/views_vcards",   "description": "Allows creation of vCards using the fields provided by the Views module.",   "type": "drupal-module",   "license": "GPL-2.0+",   "homepage": "https://drupal.org/project/views_vcards",   "require": {     "maennchen/zipstream-php": "0.3.*"   } }   But if I put a composer.json file in my module folder, how do I make Drupal aware that that file is there, and how do I make sure the required zipstream-php library is downloaded?  Simply running composer update from the Drupal root does update a lot of Drupal dependencies, but it does not include the composer.json files that are in the modules folders. I also don't assume I should be calling composer install from inside all modules with dependencies.  How do I make Drupal aware of a module's dependency without using composer manager and/or hacking core?  UPDATE:  The  appears to have support a wildcard path:  {     "require": {         "wikimedia/composer-merge-plugin": "dev-master"     },     "extra": {         "merge-plugin": {             "include": [                 "composer.local.json",                 "extensions/*/composer.json" // &lt; ---- THIS LINE             ],             "require": [                 "submodule/composer.json"             ],             "recurse": true,             "replace": false,             "merge-dev": true,             "merge-extra": false         }     } }   Why doesn't core merge modules/*/composer.json, that would solve everything right?  Update 2:  THe reasoning for not supporting this is covered in  (which also has been quiet for some time now). So I really like the tag cloud on Climate Deal. Is there anyway we could get something similar to this on StackOverflow? I don't necessarily mean that we should replace the interesting/ignored tags with this but something like this on the front page would be nice. Wrong Sentence:     Never before in the history of the world such a thing has happened, I don't think that will ever happen again.   Right sentence:     Never Before in the history of the world has such a thing happened, I don't think that will ever happen again.   Why “has such a thing happened” is the right form, and why can't I use such a thing has happened? iMac with 8GB RAM -- memory always almost full The security guard problem Got this as homework and I don't know how to tackle this. Help please!  Prove that the isometries of $\mathbb{S}^{n} \subset \mathbb{R}^{n+1}$, with the induced metric, are restrictions to $\mathbb{S}^{n}$ of the linear orthogonal transformations.