I'm trying to create a random map, with lists inside the main list representing the lines. The "createBlankMap" function works perfectly fine, for creating a placeholder map, and the "displayMap" function also works fine, for printing the map and changing the 0s or 1s to "." or "#". But when i try to update the blank map, using the "generateMap" function, all the nested lists get the same random generated value, instead of all of them generating random generated values.  # -*- coding: utf-8 -*- import random  def displayMap(canvas):     for i in range(len(canvas)): #LINE         for j in range(len(canvas[i])):             if canvas[i][j] == 0:                 print(".", end='')             elif canvas[i][j] == 1:                 print("#", end='')             else:                 break         print()  def createBlankMap(x,y):     MAP = []     LINE = []     for j in range(y): #COLUMN         LINE.append(0)     for i in range(x): #LINE         MAP.append(LINE)     return MAP  def generateMap(canvas):     for i in range(len(canvas)): #LINE         for j in range(len(canvas[i])): #COLUMN             choice = random.uniform(0,1)             if choice &lt; 0.5:                 canvas[i][j] = 1             else:                 canvas[i][j] = 0     return canvas  displayMap(generateMap(createBlankMap(5, 10)))   The output is always like this: (remembering those values are randomly generated, so they're different every time i run the program).  ###.##.#.# ###.##.#.# ###.##.#.# ###.##.#.# ###.##.#.#   So basically, i want all the lines to have random generated values, instead of them repeating the first one.
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 have a LaTeX editing environment that does some assistive stuff such as auto-indenting, closing parentheses, etc.  However, one of the things that it does is unknown to me, and is difficult to search for. If I type an empty set of braces, it replaces them with  {}&lt;++&gt;   If I type two empty sets, for example when I'm setting up a fraction \frac{}{} what I actually get is  \frac\left\{ } \right\}&lt;++&gt;}&lt;++&gt;   Is this a problem? What does &lt;++&gt; do?  Edit: This is using Computing: $\int_0^1 \sqrt[3]{x\log{\frac{1}x}} \, \mathrm dx$ Mcrypt extension is missing in 14.04 server for mysql Regex to get string between curly braces Bluetooth disappeared in Windows 10 I have a Lenovo G580 laptop. In the past, using Windows 8, I could use Bluetooth to connect to other devices.  Installing Windows&nbsp;10, Bluetooth simply disappeared. I can't find anything related to Bluetooth in the Device Manager, also in Settings → Devices.  There is no Windows&nbsp;10 Bluetooth driver for my laptop.  What can I do? Purchasing a Switch - AC vs DC Current Specifications? I'm trying to purchase several switches for a DC system with moderately low current (a few amps at 12V). When browsing for switches in parts catalogs (e.g.  and ) there are always separate voltage ratings for AC and DC applications. I understand that AC switches are less expensive because the switching time does not need to be as fast and arcing is less of a concern. There is only one current rating listed and I am not sure if it applies to AC switching, DC switching, or both.  Does this current rating apply to both the rated AC and DC voltages? Is there a good rule-of-thumb for converting between AC and DC voltage/current ratings? What is the highest current I could reasonably expect from a DC switch before moving to a relay? I have a Gary Fisher bike (wahoo I believe). I think it's considered the entry level Fisher mountain bike.  Could I put on disc brakes as opposed to using the standard  brakes on this bike?  Standard brakes are the rim brakes.   Thanks Carlos Read two column CSV as dict with 1st column as key We have a sequence $(x_{n})_{n=1}^\infty$ in a Hilbert space $H$ and we know that:   for every $n \in \mathbb{N}$ holds $\|x_{n}\|\le1$ for every $m\ne n$ holds $\|x_{n}-x_{m}\|\ge r &gt; 0$   How I can show that $r \le \sqrt2$ ? Does the lack of sleep affect my health? In the past month, I've been really busy with the university and stuff, and I don't sleep as much as I used to. I usually sleep 4-5 hours a night.  I haven't been doing that extensively ( I always kept a good sleeping routine), but can the lack of sleep affect my health on the long term ? I'm currently reading the TeXbook, and I use \show a lot to see how Knuth defined plain-TeX macros in terms of TeX primitives. For instance, to have access to the definition of \centerline, I would write \show\centerline in my input file. When I compile  that file with pdftex in interactive mode from the command line (a Unix terminal, in my case), TeX generates an error message that shows me the definition of \centerline in the terminal and offers me a menu of options (as described in Chapter 6: Running TeX in the TeXbook).  I understand that design choice by Knuth of having TeX generate an error message for each instance of \show: he probably wanted to leave the user some time to read what \show... prints in the terminal before letting TeX resume execution, instead of having to open the log file only after the end of the compilation.  However, instances of \show... in the input file have the undesirable side-effect of raising "errors" (false alarms, really) when pdftex is called from within an IDE such as TeXmaker with option -interaction=nonstopmode. For example,  \show\centerline \bye   when compiled with pdftex -interaction=nonstopmode causes TeXmaker to report     Obviously, those false alarms prove really annoying when debugging. I always have to ask myself: Wait... are those errors due to instances of \show in my input file, or are they bona fide errors? On the other hand, my understanding is that you have to specify  -interaction=nonstopmode   if you want to call pdftex from within an IDE. Therefore, my question is:  Is there any way of preventing TeXmaker from reporting those "false alarms"?  Note: the problem I describe may be present in IDEs other than TeXmaker as well. I was surprised to only recently notice that      An object of any density can be large enough to fall within its own   Schwarzschild radius.   Of course! It turns out that supermassive black holes at galactic centers can have an average density of less than water's.  Somehow I always operated under the assumption that black holes of any size had to be superdense objects by everyday standards.  Compare the Earth to collapsing into a mere 9mm marble retaining the same mass, in order for the escape velocity at the surface to finally reach that of light.  Or Mt. Everest packed into one nanometer.  Reading on about this , it increases proportionally with total mass.  Assuming matter is accumulated at a steady density into a spherical volume, the volume's radius will only "grow" at a cube root of the total volume and be quickly outpaced by its own gravitational radius.  Question: For an object the , what would have to be its diameter for it to qualify as a black hole (from an external point of view)?  Would this not imply by definition that:   The Earth, Solar system and Milky Way are conceivably inside this black hole? Black holes can be nested/be contained within larger ones? Whether something is a black hole or not is actually a matter of perspective/where the observer is, inside or outside? When does a gerund become a verb? My question is a follow-up to one in which I identified stealing and killing in a particular sentence as gerunds. Bill J commented to the effect that if objects followed these gerunds, the latter became verbs.   My questions are why and what form of the verb? For me the grammatical distinction between “I dislike killing” and “I dislike killing sheep” is simply that the gerund complement in the first becomes a gerund phrase complement in the second. I tried:   Launching Ubuntu Software Centre I typed in "air" and found "adobe air" It says "available from the 'maverick-partner' source. and has a button "use this source" I clicked "use this source", I saw a "in progress (1)" icon come up in the side bar, and disappear, but nothing happened/changed.   I'm stuck.  I have actually already added the maverick-partner source to apt so I could install sun-java6-jdk. My Pakistani passport expires less than a month from now. I understand that some countries only let people in if their passport is valid for six months or more. Will I be able to enter Pakistan on a passport that is about to expire?  Also, travelling back to Pakistan is likely to involve transiting through some other country.  Does the six-month rule still apply to people returning to their country of citizenship? Ejecting a USB 3.0 drive connected to USB 3.0 port reconnects immediately Stacking Multiple Ternary Operators in PHP Expected time to roll all 1 through 6 on a die What is the meaning of the term "thread-safe"? Does it mean that two threads can't change the underlying data simultaneously? Or does it mean that the given code segment will run with predictable results when multiple threads are executing that code segment? How many RSA keys before a collision?