I have an array that has X number of values.  I'm trying to make an array of arrays with 10 items each of X. How do I go on about in doing something like this?  I've tried using a count while iterating it and let's just say I didn't get anywhere with that.   I want something like   # Random list of 20 items random_array = [1,...20]  # Do cool things here  # Output after doing cool thing fancy_array = [[1,...10],[11,..20]]
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:
How to know if the system console is open? Can we know, with python, if the system console of blender is open? I know that we can open or close it with this function:  bpy.ops.wm.console_toggle()   But it doesn't return the 'state' of the system console like open or closed (True,False).  I want to be sure that the console is open when i execute one of my script. jQuery Isotope filter to no items? Solving factorial equations I am given that $${n \choose a}={n \choose b}$$ I need to show that $n=a+b$ or $a=b$.  Now I am left with $a!(n-a)!=b!(n-b)!$.  I don't know what to do next. I checked there on google to solve the above, it says:- "On comparing, we get the required result." But it makes no sense to me. How to write startup script for Systemd? I have 2 graphics cards on my laptop. One is IGP and another discrete.   I've written a shell script to to turn off the discrete graphics card.  How can I convert it to systemd script to run it at start-up? Group theoretic meaning of natural isomorphisms between certain functors How to render from Eevee in Blender 2.8? I have the Blender 2.8 version from the 21st Sep 2018 I was looking forward to render a test sequence but cannot find a render button anywhere? Does anyone know where to find it? Why can't photons have a mass? Why can't photons have a mass? Could you explain this to me in a short and mathematical way? I am not sure of the meaning of this sentence:     The significance of culture and identity in development has to do not so much with the cultural factor in the process of development as with abandoning Eurocentric development thinking.   I'm not sure what the use of as is supposed to convey. Does it mean "development has to do not so much ... as with abandoning", i.e. not as much as abandoning? Does the abandoning have more to do with it?  And the second question: Why does it use "has to do not so much". Why not "has not so much to do"? Is "have to" a verb? Using have gone to / been to / been in I understand the difference between these constructions: "has gone to", "has been to", "has been in":   "has gone to" &mdash; there or on his way to; "has been to" &mdash; someone has been there but he is on his way back; "has been in" &mdash; someone is still there;   But now I am puzzled by next statements:   Have you ever been to / in Greece? &mdash; Yes, it's a very beautiful country; When did you last go to Canada? &mdash; I've never been to Canada.   If I use "has you ever gone to Greece" construction in the first case or "I have never gone to Canada" in the second statement will it be uncorrect? Or just will sound odd? May I say "I have never been in Canada" in the second sentence. Or in these case all of the variants are possible, the problem is in how people usually say it (in what how it perfectly sounds)? I have a bash script which must call another bash script which varies per-user in order to get some configuration information, like so:  somescript:  #!/bin/bash ${HOME}/.ssconfig echo "Hello, ${VARIABLE}!"   ~/.ssconfig  #!/bin/bash VARIABLE=world   Which, instead of giving me Hello, world! as expected, gives me Hello, ! How can I pass variables up from a script to the one that called it? I was caught cheating on an exam, how can I minimize the damage? I got caught cheating in a two-hour engineering exam consisting of 100 multiple choice questions which was done online through the  e-learning software. I feel like my life is almost over.  Having not studied well and having no time to study, I decided to cheat. I know there are no excuses for cheating. Before the exam I dug up research about moodle exams, and it turned out you can take the exam anywhere you want to as long as you have the quiz password. Taking advantage of this, I went up to my engineering library and asked a close friend who was taking the exam to send me the quiz password before he starts.  What I had prepared:   Calculator (was not allowed during the quiz). Printed material (consisted of more than 200 pages). Google search engine (on a laptop ready to help). Whatsapp (to ask questions for a friend who took the quiz last year).   As I sat down, I did the first 50 questions, suddenly the quiz froze and moodle told me:      you are not allowed to take the exam from this location.   While I was leaving, one instructor responsible for the course (there are 5) came and found me. She accused me of cheating, took my mobile and made come with her to a huge office where two instructors searched all my mobile (took the name of my friend who gave me the password), and started talking to me, asking for all details of this crime. They took and confiscated my phone and looked at everything: Whatsapp conversations, all my emails, and images. The instructor took the mobile from my hand without asking me and kept it with her. It seems that the instructors are going to report me as well as my friend who sent me the password for the exam.  The university's Student Code Conduct said that cheating will result in one of the following: a Dean's Warning, Suspension, or Expulsion. If any of that happens, my future is over. A dean's warning will cancel my financial aid. A suspension would be for at least two years, and coming back would require a lot of work. An expulsion will be definite.  I've learned the lesson about cheating, now how can I fix this? How can I prevent the five instructors from reporting me? It's obvious that I should speak to them, but what should I say? What can I do? My future is almost over, but many of you are teachers and instructors here, what can I do to fix this?    EDIT: Wow, it has been almost 3 years. I would like to update on how I dealt with the situation.   Lesson: It was obvious to never ever cheat under any circumstances, and it was not whether you'd get caught or not.    Consequences: I received a Dean's warning but the financial aid wasn't revoked. However, I couldn't stay in the department as engineering was not for me and I was even ashamed to stay in the university.  What happened next: I transferred to an ABET-accredited Computer Science institution and I graduated with distinction in 2.5 years. It was extremely stressful as I had taken 6 major courses (18 credits) in one semester, but I had to do it.  Future plans: I'm going for an MSc in Computer Science in St Andrews next year. How do Stack Overflow questions appear in Google search results in seconds? Possible Duplicate:          I have noticed that when I ask a question on Stack Overflow and I go into Google and search for the question, it comes up in Google in just a minute or so.  How do they do this? I want the secret!  I am a web developer and I know about most things that you can do for SEO, but I have no idea how these questions appear in Google this quickly!  I think it's amazing! All my properties are zero, and my array is zero, even though I have populated them with numbers and objects How to color particles based on the texture of the object from which they are emitted, using the "grid" emission setting? I am aware it is common practice to standardize the features for ridge and lasso regression, however, would it ever be more practical to normalize the features on a (0,1) scale as an alternative to z-score standardization for these regression methods? Intuition on the Kullback–Leibler (KL) Divergence Going into a directory linked by a link Proving a direct product of groups is a group I am trying to prove the following and am looking toward the math.stackexchange community to comment on whether I am on the right track or not. Thank you in advance.    Let $n \geq 1$ be an integer. Suppose $\{G_1,...,G_n\}$ is a finite set of groups. Define the set $G = G_1 \times G_2 \times ... \times G_n$ of ordered n-tuples $(g_1,g_2,...,g_n)$ where $g_i \in G_i$. Show that the operation $\bullet$: $G \times G \rightarrow G$ given by $(g_1,g_2,...,g_n) \bullet (g'_1,g'_2,...,g'_n) = (g_1g'_1,g_2g'_2,...,g_ng'_n)$ makes $G$ into a group.    Proof of associativity: $((g_1,g_2,...,g_n) \bullet (g'_1,g'_2,...g'_n)) \bullet (g''_1,g''_2,...,g''_n)$ = $(g_1g'_1,g_2g'_2,...,g_ng'_n) \bullet (g''_1,g''_2,...,g''_n) $ = $(g_1g'_1g''_1,g_2g'_2g''_2,...,g_ng'_ng''_n)$ = $(g_1,g_2,...,g_n) \bullet (g'_1g''_1,g'_2g''_2,...,g'_ng''_n) = (g_1,g_2,...,g_n) \bullet ((g'_1,g'_2,...,g'_n) \bullet (g''_1,g''_2,...,g''_n))$  \  Proof of the existence of an identity For each $G_i \in G$, take its identity element $e_i$ and multiply it as follows: $(g_1,g_2,...,g_n) \bullet (e_1,e_2,...,e_3)$ = $(g_1,g_2,...,g_n)$.  \  Proof of the existence of an inverse: Since each $G_i \in G$ is a group, simply takes its multiplicative inverse $g_i^{-1}$ and multiply it: $(g_1,g_2,...,g_n) \bullet (g_1^{-1},g_2^{-1},...,g_n^{-1}) = (e_1,e_2,...,e_n)$. Should I upgrade my body or lens first? I have an entry-level Nikon DSLR, and I cant decide if I should upgrade my camera body or upgrade from a  AF-S DX Nikkor 18-200mm to whatever else might be recommended? Now that I've reached 2k on Stack Overflow, I get access to the "Suggested Edits" review queue.  Although I only have 20 edits per day, the "suggested edit awaiting" icon in the top bar is always there and it bothers me a lot!  My suggestion is to apply one of three solutions:   Remove the suggested edits icon when we reach the maximum (50) edits Remove the Highlight (orange) on the suggested edits Remove the suggested edits part when we click on it   What do you think?