I have one list but I'd like to divide this list into a list of lists. The final list should be made of lists with 4 items in each lists. The order of the original list should remain the same.   For example:  lst = ['201,904', '17,998', '14,421', '14', '66,000', '5,502', '9,428', '7', 0, 0, 0, '0', '32,300', '2,816', '10,766', '3']   Goal_lst = [['201,904', '17,998', '14,421', '14'], ['66,000', '5,502', '9,428', '7'], [0, 0, 0, '0'], ['32,300', '2,816', '10,766', '3']]   I'd like to also be able to carry out this function if I wanted the Goal_lst to have each sublist only 2 items.
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:
Printing pointers in C How do I add reCaptcha to a custom form? I need to add a reCaptcha to my form; creating the form then adding the form ID to the reCaptcha settings did nothing. "Hail Mary", "Glory Be" in the plural Possible Duplicate:          In the rosary, a Catholic sacramental composed of prayer beads, there is a short prayer concluding each decade called "Glory Be" ("Glory be to the Father, Son and Holy Spirit...").  Would the plural be Glory Bes or Glory Be's?  Likewise, do you say 10 Hail Marys? How to connect faces between 2 edge loops? I'm trying to fill empty space in my mesh, and I looked at the knife tool page on the Blender Wiki, and I'm not sure if there's a way to make it so that a new edge is made using the knife tool. I took a screenshot, and hopefully it'll explain better than I can of what I'm trying to do. Oh and I'm using Blender version 2.71, by the way. I have seen  and altough I face the same problem, the answer to that question is not helpful to my case.   I have large spreadsheets which are changed frequently. So, according to the solution accepted to that question, it is hard to duplicate all populated columns and it is cumbersome to edit one more cell everytime I wish to make a change on cells background colors.  Isn't there a way to sum data based on a condition regarding cell background color in Google Spreadsheets? Quantum entanglement faster than speed of light? How general is the Lagrangian quantization approach to field theory? ConTeXt: Flush right formula numbers in cases environment I would like to have the formula numbers of the cases environment flush right like regular formulas (not at a fixed distant from the cases like it is by default with the default setting numberdistance=2.5\emwidth). How can I do that?  \starttext  \startplaceformula     \startformula         \startcases             \NC x = 1 \NR[+]             \NC y = 1 \NR[+]         \stopcases     \stopformula \stopplaceformula  \stoptext     What I want (but with the left bracket):  \starttext  \startplaceformula     \startformula         \startalignment[n=1]             \NC x = 1 \NR[+]             \NC y = 1 \NR[+]         \stopalignment     \stopformula \stopplaceformula  \stoptext How can I randomize order of elements in a list? Any idea what kind of tool should I but to fix the loose left crank on my bike? I found this  but not sure if it's gonna suit. Or is it enough to buy only nut driver? Instantiating object of type parameter For wall-sized graphics and large banners (e.g. 3m × 5m), what is an acceptable PPI for print? As I understand it 300 ppi is the typical for 'small' artworks (esp. for clean text resolution). However, for small artworks, the audience usually engages at a much closer distance. Therefore, in the interests of keeping a bitmap file down to a reasonable size, can you get away with a much-reduced PPI for a large format/banner print? How to nest code within a list using Markdown Oftentimes, I want to include code samples in a list, for example:   Item One Item Two, for example: private bool ItemTwo() {     return this.IFeelLucky; } Item Three   The problem is that there isn't a good and intuitive way to do this using . It's doable, but you have to do some formatting black-magic to get it that way, which is just not "nice" to deal with.  Source that produces this:  1. Item One 2. Item Two, for example: &lt;br/>&lt;br/>&lt;pre>&lt;code>private bool ItemTwo()     {         return this.IFeelLucky;     }&lt;/code>&lt;/pre> 3. Item Three    I would love to just be able to do it this way:  1. Item One 2. Item Two, for example:      private bool Test()     {         return this.IFeelLucky;     }  3. Item Three  Which results in, well, this:   Item One Item Two, for example:  private bool Test() {     return this.IFeelLucky; } Item Three Can a purely biological account of man show a superiority over other animals other than that of belonging to a later stage of evolution or of greater possibilities of action, a superiority “in his very being”? I need to find a way of proving that the square roots of a finite set    of different primes are linearly independent over the field of    rationals.    I've tried to solve the problem using elementary algebra  and also using the theory of field extensions, without success. To  prove linear independence of two primes is easy but then my problems  arise. I would be very thankful for an answer to this question. I know that the finite sum of Bernoulli i.i.d. random variables is a binomial distribution, but what is the distribution of $$\lim_{n \to \infty}\sum_{k=1}^{n} \frac{x_k}{2^k}$$ where $x_k$ is a Bernoulli random variable with parameter $\frac12$? I am currently working on a model which takes two parameters and produces a measurement statistic. Think of it as Z = f(X,Y).   Z is a matrix of my statistics and I am creating a surface plot of it in matlab. Basically, I am looking for a mathematical/analytical way of determining if the surface is smooth, or if it is jagged. Do large values tend to be clustered together or are they dispersed throughout the matrix? - that is my question. Basically, how mixed up are the values of my matrix?  I need to run the model over different parameter sets and I want to be able to analytically determine which one of my surfaces is the smoothest, has the greatest clustering of large values, and ideally, has no negative values.   Any help will be greatly appreciated and please let me know if you need any further information.   Cheers Render looks darker than Look Dev mode I have been texture painting in look dev mode. But when i try to render it, everything looks very dark. I have 3 sun lights in my scene, ambient turned on in Eevee settings. What am i missing? I really like the look of my scene in Look Dev mode, how can i achieve the same look when my scene is rendered too? I'm on a Sprint Samsung Galaxy S3 with Android 4.3.  I would love to become a power user of the dictation feature to dictate text messages and emails. More often than not, however, I have to hand-edit the dictated text not because of text comprehension issues but because of punctuation, capitalization and spacing problems.  These are the "commands" I've found to work. What is the full list?  "period"     --&gt; .   (works fairly reliably) "comma"      --&gt; ,   (works fairly reliably) "new line"   --&gt; \n  (works about 50% of the time)   I've not gotten capital or anything like that to work, or acronyms. If you know how it works, please share. Why does the compiler say "a constant value is required" for the first case...the second case works fine...    switch (definingGroup) {     case Properties.Settings.Default.OU_HomeOffice:           //do something           break;     case "OU=Home Office":           //do something         break;     default:         break;  }   also tried...  switch (definingGroup) {     case Properties.Settings.Default.OU_HomeOffice.ToString():           //do something         break;     case "OU=Home Office":         //do something         break;     default:         break;  }   ...same error  Here's the Properties.Setting code  [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("OU=Home Office")] public string OU_HomeOffice {     get {         return ((string)(this["OU_HomeOffice"]));     } }