Here's my list : list = [(a,1,2),(b,3,4),(c,5,6),(d,7,8),(e,9,10)]  I want to fetch the second element of the first three tuples. In this case it would be 1,3,5. Here's what I did : [item[1] for item in list]  But this would return all the elements, while I only need the first three. How do I do that?
I need a good explanation (references are a plus) on Python's slice notation.   To me, this notation needs a bit of picking up.   It looks extremely powerful, but I haven't quite got my head around it.
pgfplots axis scaling Is it possible to define in pgfplots that y should correspond to Y cm in my plot?   I know how to do this in tkz-fct, so let me add an tkz-fct example to make more clear what I want:  \documentclass{article}  \usepackage{pgfplots} \usepackage{tkz-fct} \usetkzobj{all}  \begin{document}  \begin{tikzpicture}[scale=.5] \tkzInit[xmax=10,ystep=3,ymax=10] \tkzAxeXY \tkzGrid \tkzFct[color=red, thick,domain=0:10]{\x} \tkzFct[domain=0:10]{\x**2} \end{tikzpicture} \begin{tikzpicture}[scale=.5] \tkzInit[xmax=10,ystep=1.5,ymax=10] \tkzAxeXY \tkzGrid \tkzFct[color=red, thick,domain=0:10]{\x} \tkzFct[domain=0:10]{\x**2} \end{tikzpicture}   \end{document}     In one case 3 corresponds to 0.5 cm on the y-axis in the picture, in the other case 1.5 corresponds to 0.5 cm on the y axis. This is achieved by using the scale=0.5 option together with the ystep option.  Not that it is important for me to have grids as in the tkz-fct example. Construct a command by putting a string into a tty I managed to do this  echo -n "command" &gt; /dev/tty1  The letters appear, and the cursor moves, but they are "ghosts" – if you hit Enter, nothing happens (they are not in stdin).  Edit:  In the middle of the below screenshot, you see why I see the use of this. (The line with a red caption, right below the line with a yellow caption.) As it is now, you are not really "editing" the note text; you are just asked to write a new text, which will replace the text of the note you are (not really) editing. Thus, I thought it could be remedied by simply pasting the old text into the tty: if the user hits enter, no modification is made. (This program is in Perl/MySQL, but I thought it would be more interesting to ask for a general solution than "how do I do this in Perl".)    Edit 2:  Here is the Perl code, that uses the C code below (works exactly as intended), as well as a new screenshot – hopefully this will clarify things beyond doubt :) Again, look at the middle of the screenshot, where the edit is made to the note text - this time around, the old text is there, for example if you just wanted to fix a typo, you won't have to retype the entire note text.  my $edit_note_text = $edit_note_data[2]; print BOLD, RED, " new text: ", RESET; system("writevt /dev/tty \"$edit_note_text\""); my $new_text = &lt;$in&gt;; $new_text = fix_input($new_text); my $set_text = "UPDATE notes SET note = \"$new_text\" WHERE id = $edit_note_id"; $db-&gt;do($set_text); why $1+\frac{1}{1+\frac{1}{\frac{1}{1+\dots}}}$ cannot be equal to $\frac{1-\sqrt{5}}{2}$  I know that some of you will answer because it is positive.I know it but I don't know how to prove it.Maybe the second part is positive how do you know that?Thanks in advance. How does polynomial long division work? Effectively creating this effect in Illustrator? Been lurking awhile but this is my first post.   I've always wondered what this effect is called and I'm almost certain there's an easier way to doing it than how I do it. I'm talking about the "empty" stroke around overlapping parts of icons.   In this case I would put a stroke that's the color of the background around the first character. I know this is bad practice for many reasons, but I haven't found a way to use the pathfinder to do this.  I'm looking for a way to do it that would effectively cut away the shapes smoothly in a X amount of pixels around a certain shape instead of covering it up so I can save the icon and use it over whatever colored background I want to.  I'm guessing I'm not the first person to ask this but I have no earthly clue how this effect is called so my research has returned nothing relevant. How can I simulate OO-style polymorphism in C? Is there a way to write OO-like code in the C programming language?    See also:       Found by searching on "[c] oo". Let $a_{n+1}=\sqrt{a_1+a_2+\cdots+a_n}$ .Prove that $ \lim\limits_{n \rightarrow \infty} \frac{a_n}{n}=\frac{1}{2}$ A sequence $a_n$ is defined as $a_1=1$ and $a_{n+1}=\sqrt{a_1+a_2+\cdots+a_n}$ .Prove that $ \lim\limits_{n \rightarrow \infty} \frac{a_n}{n}=\frac{1}{2}$  I have no idea how to approach this. But I have a feeling that Cesaro's lemma may come in handy Are neutrinos affected by electromagnetic forces? I know they don't interact with matter nor any electromagnetic forces, but I know they have mass, very little mass but they have. When something has mass it must be attracted by gravity and other objects (electromagnetic) right? Why do harmonics occur when you pluck a string? When you energise a taut string, the following resonant modes of vibration occur:    Plotting on the frequency domain, you can see their corresponding frequencies:    But what is the underlying physical principle? Why does this happen?  Is there any way of explaining it that could be understood by a smart 15 year old?  EDIT: I'm going to give my best attempt so far. Here goes:   We can start with sympathetic resonance. Sounding a particular frequency, a pure sinewave.  And noticing the string resonates sympathetically at the frequency of each harmonic. Say this is explained and understood. Now imagine that plucking a string is equivalent to a burst of white noise, which contains frequencies all the way through the spectrum. This could be approached backwards, by starting with random frequencies and noticing that resultant wave produced looks like white noise.   If the above is scientifically correct, then it restricts the domain of the question.  I would really like to be able to understand it scientifically and also be able to explain it intuitively.  PS Images from "that which" used together When I read essays from Eliot, I find him using "that which" frequently, e.g.        the combination which is the murder of Agamemnon is probably as complex as that which is the voyage of Ulysses.   A very small part of acting is that which takes place on the stage!   They belong to a different race. Their crudity is that which was of the Roman, as compared with the Greek, in real life.      I can kind of guess its usage, but I want to know more about this grammar structure. Searching on Google mostly gave me the simple difference between "that" and "which", and some examples using "that which":        that which we call a rose (from "Romeo and Juliet")   that which we persist in doing      It is a pity that Google search does not direct me to any useful page about "that which".  Can someone explicate its grammar for me? The category Set has the property that any morphism f can be decomposed into an epimorphism $e$ and a monomorphism $m$ with $f$ = $m\circ e$. (The intermediary set object is the image of $f$.)  Is there a name for this construction?  Is there a name for this property of categories?  In Set, the intermediary object is unique up to isomorphism. Is this the case for all categories with the property? Why does the beta distribution become U shaped when $\alpha$ and $\beta$ <1? In the Beta distribution (used to model Bernoulli probabilities), the $\alpha$ and $\beta$ parameters can be interpreted as the number of heads$+1$ and the number of tails$+1$ seen. So, if they were both $2$, it would lean towards the coin being fair and have a maximum at $0.5$. If they are both $20$, the distribution would become even surer we're dealing with a fair coin and peak even more at $p=0.5$.  What I don't get is its behavior when $\alpha$ and $\beta$ both become $&lt;1$.   In that case, it becomes U-shaped and the density peaks at $p=0$ and $p=1$. Meaning the coin is likely to be two-sided. I know there is an intuition for this since I think I had an idea about it a long time ago. However, I've been trying to recollect all day and can't piece it together. Does anyone have an intuition? Consider the following example:  \documentclass{article} \newtheorem{Theorem}{Theorem} \begin{document} \begin{Theorem} On the other hand, this one has only one claim. \end{Theorem} \begin{Theorem} \begin{enumerate} \item First claim \item Second claim \end{enumerate} \end{Theorem} \end{document}   Typesetting it results in:    Notice there is extra horizontal space before the first item in the list of the second theorem.     Is there a sensible way to get rid of that?   Ideally, the solution would work with amsthm, thmtools, enumitem.  N.B.: this is related to  but not quite the same. Proof that a sequence is convergent I'm asked to prove the convergence of the sequence $$X_n=\left(1+\frac12\right)\left(1+\frac14\right)\left(1+\frac18\right)\cdots\left(1+\frac{1}{2^n}\right)$$   I proved that it is increasing through the ratio test and then I want to prove that it is bounded.  My question is the following : is it enough to say that $X_n&lt;\left(\frac32\right)^n$ for $n&gt;1$ or not ? Namely, can we say that a sequence is bounded if $\forall$  $n$ ,  $\exists$ a $N$ such that $X_n&lt;N$ or do I have to find a N such that $\forall$  $n$ , $X_n&lt;N$?  In other words, can a bound depend on $n$ ?  Thanks for your help. due to versus as a result of Prove that , any primitive root $r$ of $p^n$ is also a primitive root of $p$ What is the best way to iterate over a dictionary? I've seen a few different ways to iterate over a dictionary in C#.  Is there a standard way? I've got a capture the flag arena. One issue we keep running into during play, is that of clutter.  We have /gamerule keepInventory false, so the pitch gets rather cluttered with armor, weapons and building materials, such that it becomes difficult to pick the flag up, due to full inventories.  I've discovered the following command to remove all drops from the arena:  /kill @e[type=Item]   However, this removes all the floating items from the ground. I'd like, if possible, to preserve the flag from being destroyed.  I have this command for detecting the flag:  /testfor @e[type=Item,x=40,y=1,z=40,dx=40,dy=27,dz=80] {Item:{id:"minecraft:banner",Damage:4s}}   But I'm not sure how to combine the two in a way that it will destroy everything except for the flag.  Any ideas? How does the Deposit-User work? How can slightly blurred photos be improved in post processing?