Joining a list in python with different conditions and separator I have a list of integer  a=[1,2,3,4,5,6,7,8,9]  and i must create a string with the integers separated by spaces and every five number i must add a '\n'  string='1 2 3 4 5\n6 7 8 9\n\n'    I have tried with a join like that:  string=' '.join(a)  but i don't know how to add '\n' with a condition.
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:
invalid conversion from ‘const char*’ to ‘char’ How do I root my Nexus 7? I am wanting to gain root privileges on my Google Nexus 7 tablet, running Android 4.1-4.2.1. How can I do this? How could I retrieve the exact duplicate value from conditionally formatted list that highlight duplicates? I have imported a webpage table in to Google Sheets. It frequently being updated. A series of calculations has been conducted on the sheet named Shawn Of the link spreadsheet.  I have filtered the my desired results into the Calculation sheet of that linked document... which is in columns A5:A. I then applied =ARRAYFORMULA(if(A5:A200=&quot;&quot;,,A5:A200*{12,13,37,101,111})) in columns B5. The Results of the formula extends from B5:F. This results from a5:F was subsequently conditionally formatted to highlighted duplicates in the aforementioned, i.e. a5:f using the lists of values in K5:K and I5:5. In Columns A5:F, is it possible to generate/place values in the range A5:f with matching name of states and aligned values in J5:K and H5:I? Skewness, kurtosis and how many standard deviations values are from the mean As is well known for the normal distribution, 68% of the probability mass is within one standard deviation of the mean, 95% within two standard deviations and 99.7% within 3 standard deviations.   However, I have some empirical distributions that are leptokurtic and negatively skewed. In such circumstances is there a formula based on their higher-order moments to calculate how much of the probability mass is within so many standard deviations of the mean?   I have a measurement and would like to give some sense of how far it is from the midpoint (mean or some other measure of central tendency).  Can this be done? How do I properly use the "Not an Answer" flag? What is the "Not an Answer" flag and what is its purpose? When should I use this flag? When should I not use this flag? But I'm still not sure if I'm using the flag correctly... An answer is "Not an Answer", but the flag was declined or disputed!   See also: When a player joins the server, this command block (containing gamemode 2 @a) puts them into gamemode 2/adventure mode. How can I change this so that only non-admin/not "opped" players' gamemode gets changed? How to derive this version of variance formula A probably very easy computational question, but I don't really understand how it's done:  I try to compute the point estimates of a normal distribution as $N \sim (\beta, \sigma)$. Using the method of moments, we get:  $$\frac{1}{n} \sum_{i=1}^{n} X_{i} = \hat{\beta}$$  $$\frac{1}{n} \sum_{i=1}^{n} X_{i}^{2} = \hat{\sigma}^2 + \hat{\beta}^2$$  Solving the two equations for the two parameters, we get:  $$\hat{\beta} = \overline{X} $$   and   $$\hat{\sigma}^2 = \frac{1}{n} \sum_{i=1}^{n} (X_{i} - \overline{X}_n)^2 $$  My question is: How do we get to the term of $\hat{\sigma}^2$? If I try to compute it, I get:  $$\hat{\sigma}^2 = \frac{1}{n} \sum_{i=1}^{n} X_{i}^2 - (\frac{1}{n} \sum_{i=1}^{n} X_{i} )^2 $$  Can someone show me how to simplify the last term to what is stated above and what "rule" or law" is used there? Since it is used so often, I really wanna understand this. Can you please explain this to me?          Could you please explain this to me?   I am unable to figure out which to use which situation. I did google, and some posts say they are both the same, even if the second one is more formal. Other posts say could is the past tense of can, but in the above example, I don't think could is used as past tense of can.  What is correct way to use these words? scp copy over ssh doesn't work - permission denied error, please? How to count number of words from String using shell Can I safely use my camera with a external power supply? Give moderators the option to select a deletion reason when removing posts What's the term for using the wrong word because it sounds the same? I was reading about various terms for incorrect words, but they didn't seem to fit.  I saw a post where someone said "what do you like to do when you're board?".  That kind of thing.  Also, would that be considered a mistake in grammar?  I didn't think so, but my friend insists it is.  I'm not sure if there even is a word for that kind of mistake, but was just curious about it.  Thanks! mysqldump, preserve update_time and modify_time attributes as listed by show table status from Does mysqldump preserve the create_time and update_time attributes that are output by show table status from?  If not, is there an option that does this?   it looks like mysqldump preserves this data if you export to XML. EDIT: Well the data is included in the export. Whether it's read in at the other end I'm not sure.  Is there a way to do this with a normal .sql dump? Why wget doesn't verify SSL certificates? I have a problem with my Fedora 8 installation. It looks that wget doesn't know how to verify SSL certificates any more. It's strange because I have another Fedora 8 box which I believe has the same configuration and it works!   How can I make it work without using --no-check-certificate switch?  This is a sample output:  wget https://www.google.com --2011-09-23 00:11:13--  https://www.google.com/ Resolving www.google.com... 74.125.230.146, 74.125.230.147, 74.125.230.148, ... Connecting to www.google.com|74.125.230.146|:443... connected. ERROR: cannot verify www.google.com's certificate, issued by `/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA':   Unable to locally verify the issuer's authority. To connect to www.google.com insecurely, use `--no-check-certificate'. Unable to establish SSL connection.   EDIT  I have this file /etc/pki/tls/certs/ca-bundle.crt file and when I run wget with --ca-certificate switch pointing to this file everything goes fine. Where should this file be placed so that I don't need to use the switch?  BTW: curl and links work fine, but lynx also complains: "SSL error:unable to get local issuer certificate" so this is not only wget's issue... Is it possible to load some package from a .sty file only if some option is selected?  (Naive approach \DeclareOption{something}{\RequirePackage{something}} doesn't work.) Do reroll and dice-adding abilities work on critical hits and critical failures? Adding Labels and arrows in Tikz graph sed -i - edit files in place does not work in compound commandq Why does my item name not show up in 1.13? I am in 1.13 Pre-Release 7 trying to make a one command creation and I need an item with a specific name. The command I use is /give @p diamond_sword{display:{Name:"Sword of Power"}} and it gives my a diamond sword, but it doesn't have the name.   This is me running the command.   This is the command not working.