Python - Group neighbor elements into tuples in a list? I have a list  A=[9.6, 7.9, 19.4, 13.3, 31.0, 16.1, 44.3, 16.4, 55.7, 16.5, 66.6, 16.7, 77.7, 17.7, 88.7, 19.0, 101.8, 21.0]   It is actually a 1-D representation of a series of 2-D points. The even-indexed values are x values, and the odd ones are y.  I now wish to convert A into  B=[(9.6, 7.9), (19.4, 13.3), (31.0, 16.1), (44.3, 16.4), (55.7, 16.5), (66.6, 16.7), (77.7, 17.7), (88.7, 19.0), (101.8, 21.0)]   What is the most pythonic way of doing so?
How do you split a list into evenly sized chunks? I have a list of arbitrary length, and I need to split it up into equal size chunks and operate on it. There are some obvious ways to do this, like keeping a counter and two lists, and when the second list fills up, add it to the first list and empty the second list for the next round of data, but this is potentially extremely expensive.  I was wondering if anyone had a good solution to this for lists of any length, e.g. using generators.  I was looking for something useful in itertools but I couldn't find anything obviously useful. Might've missed it, though.  Related question:
Construction of $\mathbb{CP}^2$ from $S^2\times S^2$ Show that $\mathbb{CP}^2$ is homeomorphic to the orbit space of $(S^2\times S^2)/\mathbb{Z}_2$. The action is given by $(x,y) \mapsto (y,x)$. My attempt: I can see that $S^2\times S^2$ is a subset of $S^5$. I am unsuccessfully trying to restrict the action of $S^1$ on $S^5$ to $S^2\times S^2$ to get the required map. Enumerate paragraphs and subparagraphs like sections but with letters I'm using pandoc and in my template.tex exists this code to make the paragraphs and subparagraphs to behave like sections.  % Redefines (sub)paragraphs to behave more like sections \ifx\paragraph\undefined\else \let\oldparagraph\paragraph \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}} \fi \ifx\subparagraph\undefined\else \let\oldsubparagraph\subparagraph \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} \fi   This code generate number like this:  1. chapter  1.1 section  1.1.1 subsection  1.1.1.1 subsubsection  1.1.1.1.1 paragraph  1.1.1.1.1.1 subparagraph   How to change this code to enumerate with letter like this:  1. chapter  1.1 section  1.1.1 subsection  1.1.1.1 subsubsection  1.1.1.1.a paragraph  1.1.1.1.a.a subparagraph While the etiquette of dealing with duplicate answers , there hasn't been a great way to deal with these, "Uh, yeah, I said this, too" types of behavior than the almighty downvote.   It would be nice to have a "Duplicate Answer" option on the flag menu. Five flags auto-deletes the answer, as with any other flag. In order to prevent abuse, the flagged answer would have to have the last owner edit (including original post) be younger than the original answer's original posting by at least 2 minutes.  Also, this ability should be a 5,000+ rep privilege, since we currently have no fanfare of rep from 3,001 to 9,999, and a power like this has a bit more umph than closing a question.  Thoughts? What is the difference between procfs and sysfs? What is the difference between procfs and sysfs?  Why are they made as file systems? As I understand it, proc is just something to store the immediate info regarding the processes running in the system. At the end of The Return of the King, Frodo, Bilbo, Gandalf, Elrond, and Galadriel left Middle-earth on a ship, along with other elves. I named those five because they were all ringbearers and it seems to be a common trait. Frodo and Bilbo bore the One Ring and the three others bore the three elven Rings.  Why did they have to do that? Why didn't they stay and have a peaceful life now that the Dark Lord was gone? I have added a background image to the world settings. However, it has disappeared from my 3D view and only shows when I view the scene from the camera. Does anyone know if there is something I can do to make it reappear? Can you attack with different weapons using Extra Attack? 'Drop us a line' - letter or phone call? According to , dropping someone a line means sending them a short message.  Is this correct? I always thought it meant phoning someone, the line referring to a telephone line. Imported TIF has dark gray background instead of white using QGIS 2.6  I import a TIF file, and expect the import to show an image that has black lines on a white background (with some other colors here and there), as the native windows viewer will see a white background.   The file, 49MB, imports, but   The TIF image has a dark gray background instead of a white background  I can't tell why.   Any hints?  The same thing happens if I import the TIF image into georeference, which is how I discovered this in the first place.  I created/exported the TIF image using PDFCreator (from a print of a PDF to a TIF, using that program).   Within PDFCreator, I chose a TIF export that set the color map to 4096 colors, as the default created a TIF file that was twice as large.  On testing with the default size (16 million colors or some such).... That file imported and showed the background as white.  And I can't tell why, for that, either.   Any hints?  ======== In response to the comment/question by @BradHards:  The TIFFTAG_PHOTOMETRIC is not present in either file.  The gdalinfo for the large file and small file are identical, but for the presence of two extra lines on the file where the white background turns to dark gray.  Each band sets NBITS=4 for Image Structure Metadata: eg:     Band 1 Block=5100x68 Type=Byte, ColorInterp=Red   Image Structure Metadata:     NBITS=4 Band 2 Block=5100x68 Type=Byte, ColorInterp=Green   Image Structure Metadata:     NBITS=4 Band 3 Block=5100x68 Type=Byte, ColorInterp=Blue   Image Structure Metadata:     NBITS=4   Something about the NBITS=4 state turns the background dark gray.  Alternatively, there is some other problem with the PDFCreator export.  These are the full GDALInfo:  Small with dark gray background:   Driver: GTiff/GeoTIFF Files: small file.tif Size is 5100, 6600 Coordinate System is `' Metadata:   TIFFTAG_DATETIME=2015:01:28 16:41:04   TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)   TIFFTAG_SOFTWARE=GPL Ghostscript 9.07   TIFFTAG_XRESOLUTION=600   TIFFTAG_YRESOLUTION=600 Image Structure Metadata:   INTERLEAVE=PIXEL Corner Coordinates: Upper Left  (    0.0,    0.0) Lower Left  (    0.0, 6600.0) Upper Right ( 5100.0,    0.0) Lower Right ( 5100.0, 6600.0) Center      ( 2550.0, 3300.0) Band 1 Block=5100x68 Type=Byte, ColorInterp=Red   Image Structure Metadata:     NBITS=4 Band 2 Block=5100x68 Type=Byte, ColorInterp=Green   Image Structure Metadata:     NBITS=4 Band 3 Block=5100x68 Type=Byte, ColorInterp=Blue   Image Structure Metadata:     NBITS=4   Large with white background   Driver: GTiff/GeoTIFF Files: larger file.tif Size is 5100, 6600 Coordinate System is `' Metadata:   TIFFTAG_DATETIME=2015:01:28 17:07:16   TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)   TIFFTAG_SOFTWARE=GPL Ghostscript 9.07   TIFFTAG_XRESOLUTION=600   TIFFTAG_YRESOLUTION=600 Image Structure Metadata:   INTERLEAVE=PIXEL Corner Coordinates: Upper Left  (    0.0,    0.0) Lower Left  (    0.0, 6600.0) Upper Right ( 5100.0,    0.0) Lower Right ( 5100.0, 6600.0) Center      ( 2550.0, 3300.0) Band 1 Block=5100x68 Type=Byte, ColorInterp=Red Band 2 Block=5100x68 Type=Byte, ColorInterp=Green Band 3 Block=5100x68 Type=Byte, ColorInterp=Blue Who was the colleague that Erik was going to contact for help? After S.H.I.E.L.D confiscates Jane's work in Thor, the researchers discuss what they'll do next.  Erik mentions two colleagues. The first is reasonably implied to be Bruce Banner, but who is the second colleague he mentions? Transcribed from the film:  Jane Who are these people? Erik I knew this scientist... a pioneer in gamma radiation. S.H.I.E.L.D showed up and... umm. He wasn't heard from again. Jane They're not going to do that to us. I'm going to get everything back. Erik mumbles Please. Let me contact one of my colleagues. He's had some dealings with these people before. I'll email him and maybe he can help. Darcy They took your laptop, too. Suppose $\sum{a_n}$ converges. How do I prove that $\sum{\frac{\sqrt{a_n}}{n}}$ converges.  So I know that just because  $\sum{a_n}$ converges, do not mean I can say anything about the converges of its square root. So I know that I can prove that if  $\sum{\sqrt{a_n}}$ converges then $\sum{\frac{\sqrt{a_n}}{n}}$ converges by Abel's Test, but I do not know where to start for the case where  $\sum{\frac{\sqrt{a_n}}{n}}$ diverges What is the derivative of this? I have a function of the following form:  $J = \|W^TW-I\|_F^2$   Where, $W$ is a matrix and $F$ is the Frobenius Norm.  How can I find the derivative of $\frac{\partial J}{\partial W}$ ? "On their back" or "on their backs"? After the therapy, eight children (43%) became able to crawl/move on their back.   Or should I use "on their backs"?   Singular because each child only has one back, or plural because we're dealing with eight backs? Argument in "thebibliography" I was reading the explanation about  and was totally confused:     The thebibliography environment has an argument which should be a string at least the length of the widest entry label in the source list. Instead of using the numbers generated by the environment as entry labels, you can specify your own by using an optional argument to \bibitem, but remember to increase the length of the argument to the thebibliography command.    What does "widest entry label" mean? Practically, what should I put as the argument in   \begin{thebibliography}{?}   or is the argument not necessary? Beamer: \nonumber equivalent for slides? Is there an equivalent command to \nonumber when one doesn't want to include certain slides in the numbering? I would like to leave outline and title slides out of my numbering, and instead just number slides with actual content. Other workarounds would be nice to know about as well.  Edit: Since a MWE example was requested, here is one. Suppose I have a title page and two other slides. The code below gives a slide counter that goes up to 3, and the title slide is slide 1. I would prefer to have the title slide not be numbered, the counter go up to 2, and the the numbering start at the slide after the title. Here is some code.  \documentclass{beamer}  \mode&lt;presentation&gt;  {    \usetheme{Dresden}  }   \setbeamertemplate  {footline}{\quad\hfill\insertframenumber/\inserttotalframenumber\strut\quad}    \begin{document}  \begin{frame}  \titlepage \end{frame}  \begin{frame} Some actual content here \end{frame}  \begin{frame} Some more actual content here \end{frame}  \end{document} What blueprints become available during story? As I progress, I realize that some blueprints open up throughout the story and don't have to be researched. Are these random or are they always the same and is there a list over those? Seems you can easily waste research point if you don't know that. Ubuntu App Development. Unable to install Ubuntu SDK and buggy Ubuntu emulator I'm sorry if this is a broad question but can someone explain to me how to interpret these regression diagnostic plots? I understand the Normal Q-Q show's how normal the spread of the data is, but the other three I am confused by. For the Residuals vs Leverage, what does it mean for a point to be outside of the bounds? What does it mean if the red lines are parabolic and curved like in the first two? Why do we care about residuals, and what do they tell us? I've searched the web multiple times for some guide to interpret these and I can't get any straight forward answers. Any help is appreciated, thank you. A guide to moderating chat How to launch the default (native) application for a given file from Java?