I want to be able to end my program after I run at any point of time. Similar to how I press ctrl + c and it says keyboard interrupt but I don't want something like   if "keyboard press here" == true:   quit()   the reason I don't want it to be like above is because it seems that my code will run until  it reaches this part of my code. Is there a command   edit:  Sorry, if I'm not clear on my question. What I mean is that I don't want my program to have to reach the point of where it says "press keyboard to quit" in my program but to have it in every space. so for example if I have a while loop that looks something like this:  while True print "1" print "2" if "keyboard press here" == true:       quit() print "3" print "4"   I'd have to wait till it prints out  &gt;&gt;&gt;1 &gt;&gt;&gt;2   before it I can press my keyboard to stop or if it passes 2 and goes to print 3 it'd look like this  &gt;&gt;&gt;1 &gt;&gt;&gt;2 &gt;&gt;&gt;3 &gt;&gt;&gt;4 &gt;&gt;&gt;1 &gt;&gt;&gt;2   and then my program will stop.  I'd like to have my program work like this:  while True     print "1"     if "keyboard press here" == true:           quit()     print "2"     if "keyboard press here" == true:           quit()     print "3"     if "keyboard press here" == true:           quit()     print "4"     if "keyboard press here" == true:           quit()   but I don't want to keep putting   if "keyboard press here" == true: quit()   every other space. Is there a way to do that?
I am aware of the die() command in PHP which exits a script early.  How can I do this in Python?
Infinite Series Convergence Verification I'm currently tackling the following infinite series in order to determine if it converges or not:  $$\sum_{n=1}^\infty \frac{\sqrt{n+1}-\sqrt{n}}{n}$$  What I've done is rearranged this to make use of the comparison test, shown below:  $$= \frac{\sqrt{n+1}-\sqrt{n}}{n} * (\frac{\sqrt{n+1}+\sqrt{n}}{\sqrt{n+1}+\sqrt{n}})$$  $$= \frac{(n+1)-(n)}{n(\sqrt{n+1}+\sqrt{n})}$$  $$= \frac{1}{n(\sqrt{n+1}+\sqrt{n})}$$  $$= \frac{1}{n^{3/2}+\sqrt{n+1}} &lt; \frac{1}{\sqrt{n+1}} &lt; \frac{1}{\sqrt{n}} $$  However, $\frac{1}{n}$ is smaller than $\frac{1}{\sqrt{n}}$, therefore:  $$  \frac{1}{n}   &lt; \frac{1}{\sqrt{n}}$$   This implies divergence by the comparison test due to the fact $\frac{1}{n}$ diverges, and if a smaller series diverges any larger series must as well.  Is this right? If I've made any mistakes in any part, please tell me! In System Info in 11.10, the graphics driver wasn't detected. I use ACER Aspire 4750 with Intel Core i3-2340M and Intel HD Graphics 3000 graphic card  How to install the driver for my Ubuntu? Should questions having lots of downvotes be downvoted further? Is down-voting an already heavily down-voted/closed question kind of like kicking a dead horse? Is this bad practice? I would like to take a picture of a street during the day to depict how much traffic and cars there are on the street.  Is there anyway to do this with a long exposure photograph?  I have a Nikon D90 and I set the f stop down to 1/16 (the lowest of my lens) and set the time to 2 seconds. Doing this, the exposure is almost saturated when taken around 5pm with the sun setting behind a tree. Doing this, the cars passing by were very hard to make out against the stationary background, being visible as a blur in the color of the car.  Perhaps this is not possible and I should just do this at night where the cars lights are much brighter than the background.  Please suggest how else I might depict the traffic in a photograph?  Are daytime long exposure photographs even possible? Do the same camera settings lead to the same exposure across different sensor sizes? Let's say I have a micro-4/3rd camera and a full frame camera, both set to 1/60 at f/2.8, taking a picture of the same scene in the same lighting. Will the exposure be the same across both cameras despite the different sensor sizes?  The reason why I'm asking is because of the difference in depth of field between micro-4/3 and full frame sensors. I'm finding that, in order to take a picture of certain scenes with the full frame camera at the same depth of field as the micro-4/3rd camera, I have to increase the aperture, which in turn forces me to crank up the ISO. Probability brain teaser with infinite loop I found this problem and I've been stuck on how to solve it.     A miner is trapped in a mine containing 3 doors. The first door leads to a tunnel that will take him to safety after 3 hours of travel. The second door leads to a tunnel that will return him to the mine after 5 hours of travel. The third door leads to a tunnel that will return him to the mine after 7 hours. If we assume that the miner is at all times equally likely to choose any one of doors, what is the expected length of time until he reaches safety?   The fact that the miner could be stuck in an infinite loop has confused me. Any help is greatly appreciated. I searched wide and far and couldn't come up with a title for a movie I watched somewhere around the mid-90ies up to early 00's as a rerun in late-night television (in Germany, specifically on Vox; but I'm sure it was an American movie to begin with).  Basically, what I remember from the story revolves around a crew in a space station or maybe space ship of some sort. Some crew members murder other crew members and there is some kind of door they are not supposed/unable to go through. Late in the movie they do go through the door and I'm pretty sure one of the first views is a skeleton of a dead security guard. It turns out the whole thing was some kind of simulation gone wrong and they find themselves to be in a (nuclear?) wasteland. And that's pretty much the revelation/wrap-up of the movie, as I recall it.  I would be delighted if somebody had any idea what movie this could be :) Thanks!  EDIT: The whole movie was in color and I think it was feature-length, not just 45 mins. Consider the sentence      E-books are on the rise, but they haven't suppressed paper books though.    This usage seems to be quite common, but when I learned English  I was taught to use "however" where I now read "though". My questions on this use of "though" are:     Is this a new trend? Is it restricted to American English? Is "though"  considered more colloquial than "however" ?    And on a syntactic level: Do you put a comma before "though"? Problem about the definition of Euclidean domain CaseComment and CaseHistory relatedlist in visualforce page I want to add CaseComment and CaseHistory related list to my visualforce page.   &lt;apex:relatedList list=" " /&gt;  What should be the value for List attribute in the code defined above. When I added   &lt;apex:relatedList list="CaseHistory" /&gt; 'Histories' is also not working   &lt;apex:relatedList list="CaseComment" /&gt; 'CaseComments' is also not working  I get errors saying they are not valid child relationship name for entity Case.  Please help me out on this issue. Puppet client not connection to master - SSL connect Error I installed the puppet master and agent on the same machine. When the client is started, I got the following error message.  puppet agent --server=agent.com --no-daemonize --debug    err: Could not retrieve catalog from remote server: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed.  This is often because the time is out of sync on the server or client How do I install OpenStack? How do I install ? Is there an easier way other than official installation instructions? Let $\mathbf A, \mathbf B$ be Hermitian matrices of the same size. What is the characterization of $\mathbf A, \mathbf B$ such that $p(\lambda)=\det(\mathbf A-\lambda\mathbf B)=0$ has only real roots?   If $\mathbf B$ is positive definite (I corrected this), it is easy to see $p(\lambda)$ has only real roots. I was hoping someone could give an overview as to how the Lie groups $SO(3)$ and $SU(2)$ and their representations can be applied to describe particle physics?  The application of Lie groups and their representations is an enormous field, with vast implications for physics with respect to such things as unification, but I what specifically made these groups of physical importance and why there study is useful.  I have just started studying these two groups in particular, but from a mathematical perspective, I'd very much appreciate understanding some sort of physical motivation. When do I use a dot, arrow, or double colon to refer to members of a class in C++? To my understanding, "Control" can have two meanings in statistics.   Control group: In an experiment, no treatment is given to the member of the control group.  Ex: Placebo vs Drug: You give drugs to one group and not to the other (control),  which is also referred as "controlled experiment".  Control for a variable: Technique of separating out the effect of a particular independent variable. Some of the other names given to this techniques are, " accounting for", "holding constant", "controlling for", some variable.  For example: In a Football viewing study (like or not like),  you may want to take out the effect of gender as we think gender causes bias, that is, male may like it more than female.     So, my question is for point (2). Two questions:  How do you "control"/ "account for" variables, in general. What techniques are used? (In terms of regression, ANOVA framework).   In above example, does choosing male and female randomly constitutes control? That is, is "randomness" one of the techniques for controlling other effects? Why are there so many close votes to review and so few of the others? Prove if $f:[a,b] \rightarrow \mathbb{R}$ is integrable, then so is $|f|$ and $\left|\int_{a}^{b}f(x)dx\right| \leq \int_{a}^{b}|f(x)|dx$ Prove that if $f:[a,b] \rightarrow \mathbb{R}$ is integrable, then so is $|f|$ and $\left|\int_{a}^{b}f(x)dx\right| \leq \int_{a}^{b}|f(x)|dx$   I already proved that |f| is integrable, but how do I show that $|\int_{a}^{b}f(x)dx| \leq \int_{a}^{b}|f(x)|dx$   ? color code in SharePoint calendar Showing $\sum_{i = 1}^n\frac1{i(i+1)} = 1-\frac1{n+1}$ without induction? I oversaw a high-school mathematics test the other day, and one of the problems was the following     Show, using induction or other means, that $$\sum_{i = 1}^n\frac1{i(i+1)} = 1-\frac1{n+1}$$   The induction proof is very standard, where the induction step relies on the fact that $\frac{1}{n+1} + \frac{1}{n(n+1)} = \frac{1}{n}$, and I'm sure it's been answered on this site before. However, I got intrigued by the "or other means" part of the question.  I don't know whether the teacher who wrote the test even considered any alternative solutions (he may just have written it so that if anyone has a crazy idea that works out, then they should get a full score for it), but I tried to find one. For instance, we may do the following telescope-ish argument: $$ \frac{1}{1(1+1)} + \frac{1}{2(2+1)} + \cdots + \frac{1}{(n-1)n} + \frac{1}{n(n+1)} + \frac{1}{n+1}\\ = \frac{1}{1(1+1)} + \frac{1}{2(2+1)} + \cdots + \frac{1}{(n-1)n} + \frac1n\\ \vdots\\ = \frac{1}{1(1+1)} + \frac12\\ = 1 $$ However, I feel that this is just an induction proof in disguise (hidden in the vertical dots). If one uses the mechanics of the induction proof to check whether the formula is true for a specific $n$, then one certainly does the exact same calculations as I have done here.  Is there a proof of this fact that clearly does not use induction (or at least hides it better)? The more elementary the better, and the ultimate goal would be to do it within the syllabus of the students taking the test (or at least not far from it). For reference, they should be familiar with the summation formula of arithmetic and geometric series and their derivations (so techniques resembling those would be well within specifications).  If there is a solution using calculus, then the students should be able to integrate elementary trigonometric functions, as well as exponential functions, logarithms and rational functions. They are familiar with integration by parts, substitution and partial fractions.  I welcome more advanced solutions as well, of course.