I am trying to create a beginner level program to better understand programming in python. A simple while true loop that adds a value of 1 to X and prints "help" or "doing something" depending on if x is less than or greater than 10; and then breaks when x is greater than 20. Im also attempting to add in a keyboard interrupt as well to break the loop if its not too complicated.. Any tips help, I get an error   Traceback (most recent call last):   File "so.py", line 23, in &lt;module&gt;     help()   File "so.py", line 11, in help     x += 1 UnboundLocalError: local variable 'x' referenced before assignment   Code:  import time  x = 1  try:      def help():          print("Help.")         time.sleep(2)         x += 1       def doStuff():          print("Doing Stuff")         time.sleep(2)         x += 1      while True:          if x &lt; 10:             help()         elif x &lt; 20 and x &gt; 10:             doStuff()         else:             break  except KeyboardInterrupt:     exit()
How can I create or use a global variable in a function?  If I create a global variable in one function, how can I use that global variable in another function? Do I need to store the global variable in a local variable of the function which needs its access?
My brother owns Skyrim on steam. We use Steam Family Share, but we were wondering how both of us could play it at the same time? How would I write the equivalent of C#'s  in JavaScript?  var haystack = 'hello world'; var needle = 'he';  haystack.startsWith(needle) == true   Note: This is an old question, and as pointed out in the comments ECMAScript 2015 (ES6) introduced the  method. However, at the time of writing this update (2015) . What's with the very slightly larger mass of the neutron compared to the proton? On the old style user pages such as mathoverflow I noticed that the long comment on the right is floating lower today than it did previously (as recently as yesterday). I don't know if we care, but I noticed it. One can contract I have to I've when have is a helping verb, e.g.     I've got an octopus in my pants.   Is contracting the main verb technically incorrect or merely antiquated? My father loves to say,     I've a month-old smoked shoulder I can cook for dinner,   and he sounds like a crazy old man when he does. I would like to know if I can shut him down by informing him that he is incorrect. :) What is the difference between: Rooting, Jailbreak, ROM, Mod, etc.? I am trying to hide Authoring information, Revision information, Publishing options tabs in create/edit node for any content type. I tried different modules with no luck. Please give me suggestions how to achieve this. Thanks a lot How can I keep recent files from appearing in Unity? I sometimes browse erotic media files but I would like to avoid having them appear in files &amp; folders / recent. How can I do that?  The old "making .recently-used.xbel a folder" trick from 10.10 and older doesn't work any more.   Plus I'd prefer to turn off tracking only temporarily.  I also prefer not to use a separate user for this, as switching users sometimes isn't fast enough. How do I transition to SSL without affecting PageRank? Here at Stack Exchange we're working on moving all traffic to SSL. The reason we're not doing logged-in-users only is that one side of the login divide would suffer a redirect from Google every time.  This happens because Google's only going to have http:// or https:// in the results, not both.  Aside from building the SSL infrastructure (), the outstanding question we have is: how do we best transition to SSL?  Here are the relevant bits of our plan (testing on small sites, moving up to stackoverflow.com):   Get SSL ready/enabled (but not linked to) on all domains Start rendering only the &lt;link rel="canonical"&gt; as https:// Start sending a 301 for all http:// requests to https:// (from our domains...of course we can't do anything about all the existing links pointing to us) After a transition period, set all user cookies as secure   So the endgame is having all content delivered over SSL and all HTTP requests redirected.  What we're primarily concerned with is how this will affect PageRank to our sites. We depend a great deal on traffic that comes from Google and want to ensure that doesn't take a dive as we start delivering more security to our users.  The only bits I've found on this that seem to be substantive are  on :     @Frank Yes, I'm certain that Google treats HTTP and HTTPS URLs as separate URLs for crawling, indexing and ranking (I work with the web-search team here at Google). Doing canonicalization with a 301 redirect like you mentioned is a great way to solve this :) –  Oct 23 '10   and the only webmasters video I could find:  The video doesn't have a solid answer, not one I'd base the future of a company on anyway.  Is our transition plan the best way to accomplish an SSL move, at least from an SEO perspective?  If there's other more recent or concrete advice around how a move like this affects Google ranking we'd love to hear about it. Sylow 2-subgroups of the group $\mathrm{PSL}(2,q)$ What is the number of Sylow 2-subgroups of the group $\mathrm{PSL}(2,q)$? Let $a=p_1^{x_1}p_2^{x_2}\cdots\cdot p_q^{x_q}$ and $b=p_1^{y_1}p_2^{y_2}\cdots p_r^{x_r}$ ,   say — Since gcd(a,b) is the largest common divisor of a and b and is divisible by any other common divisor of the two,   GCD$(a,b)=p_1^{\min(x_1,y_1)}p_2^{\min (x_2,y_2)} \cdots p_q^{\min (x_q,y_q)}$  LCM$(a,b)= p_1^{\max(x_1,y_1)}p_2^{\max(x_2,y_2)}\cdots p_r^{\max (x_r,y_r)}$  I understand GCD(a,b) has to divide both $a,b$. Therefore the exponent of any prime factor $p_i$ in GCD has to be in both $a,b$  — therefore $p_i^{\min(x_i, y_i)}$. But I'm muddled and anxious. Why does $\min$ appear in GREATEST common divisor? Why does $\max$ appear in LOWEST common multiple? What is the sum of $$\sum_{n=0}^{\infty}\frac{1}{2^n(n+1)}$$    I've spent an insane amount of time on this problem. I checked on Wolfram and it gives $ln(4)$, which I assume you get from $2\ln(2)$.   I know that the integral of $\frac{1}{n+1}$ is $\ln(n+1)$. What am I missing?  Thank you! Discriminant analysis vs logistic regression How to install Chrome browser properly via command line? I am trying to install chrome browser via command line.  I tried this:  $ apt-cache search chrome browser   The results show that the proper term is "chrome-browser," so I tried that:  $ sudo apt-get install chrome-browser   And then "Y" for the Y/n question.  But the installation threw errors.  Does someone see anything wrong with the commands I issued? Is it possible to have f.lux (software that adjusts display's color temperature) on Ubuntu 14.04? f.lux is software which adjusts temperature of your display according to time of the day. Is it possible to make f.lux work in Ubuntu 14.04? If so, maybe you can share your knowledge or point me to a guide. Finding the uniquely determined region of a PDE (a) Solve the equation $yu_x+xu_y=0$  with the condition $u(0,y) = e^{-y^2}$. (b) In which region of the xy plane is the solution uniquely determined?     I did the first part but I don't understand how to do part b.  I read   But I don't understand how the argument is based. A more clear explanation is appreciated How can I get the page title? How can we distribute Shamir's secret sharing scheme shares without a dealer? Let's say $k$ users have shares to a $(k,n)$ secret sharing scheme, and they want to issue new shares. How can they do this without collecting the shares together?  In particular, no set of $k-1$ users (including the new users) should be able to learn the shared secret during or after the share generating process. There is also no trusted third party.  One way to do this is by doing a secure multiparty computation. Is there a way to accomplish the task without a general multiparty computation scheme? Let     $$ \mathbb{Z}^{'}_{\mathbb{C}}=\{ z \in \mathbb{C} | \exists f \in \mathbb{Z}[X] \text{ monic such that } f(z)=0\} $$   be the integral closure of $ \mathbb{Z} $ in $ \mathbb{C} $. Prove that $ \mathbb{Z}^{'}_{\mathbb{C}} $ is not finitely generated as a $ \mathbb{Z} $-module.  My attempt: Suppose $ \mathbb{Z}^{'}_{\mathbb{C}}=\mathbb{Z}\alpha_{1}+...+\mathbb{Z}\alpha_{n} $ for some $ \{ \alpha_{i}\}_{i=\overline{1,n}} \subset \mathbb{Z}^{'}_{\mathbb{C}} $. I know that given $ \alpha , \beta \in \mathbb{Z}^{'}_{\mathbb{C}} $ with minimal polynomials of degrees $ m $ and $ n $ respectively, then we can construct a monic polynomial with integral coefficients $ P(z)=\prod(z-(\alpha_{i}+\beta_{j})) $ where $ \alpha_{i},\beta_{j} $ are the conjugates of $\alpha $ , $\beta $ and therefore the minimal polynomial of $ \alpha + \beta $ has degree $ \leq mn $.   I was thinking that then the degrees of the minimal polynomials of the elements of $ \mathbb{Z}\alpha_{1}+...\mathbb{Z}\alpha_{n} $ could be somehow bounded by a certain constant, whereas $ \mathbb{Z}^{'}_{\mathbb{C}}$ contains elements whose degrees of the minimal polynomials are arbitrarily large, take $ 2^{\frac{1}{n}} $ for example,$ n\geq 2$. I think this works when we are asked to prove that the set of all algebraic numbers $ \overline{\mathbb{Q}} $ is not a finitely dimensional $\mathbb{Q}$-vector space, but I don't know how to proceed in my case.  I would really appreciate any ideas, hints or solutions. Thank you very much! I am having trouble coming up with a consistent method of determining the direction of static friction.  So far the best I have come up with is: it should oppose the relative acceleration the contact point would have parallel to the surface of contact in its absence.  This seems to work up to a point:   A block sits on a rug. The rug is pulled to the left. The relative acceleration of the block to the rug is to the right. So static friction must act (in the frame of the rug) to the left.  A cyclist makes a turn to the right and leans to the right. The torque that his weight puts about the contact point will make it accelerate to the left relative to the ground in the absence of friction. So the ground sees static friction pointing to the right. A coin rotates with a turntable. In the absence of static friction, the table sees a centrifugal force on the coin that will make it accelerate away radially from the centre of rotation. So friction must act radially towards the centre of rotation, in the frame of the table.   But then I run into some difficulties.   (already solved; see first answer) A cyclist makes a turn to the right. As a result he leans to the right. The resulting torque around the centre of mass causes the point of contact to slide to the left in the absence of static friction, so static friction must act to the right. However, now the cyclist as a whole must make circular motion with static friction acting as the centripetal force. As there is no torque, this means the contact point must move along with the centre of mass and therefore act as something with an acceleration to the right. So according to my understanding of static friction, another layer of it must now be added acting to the left. Why is it not? A car enters a banked curve with speed $v$. Suppose the curve is banked at the right angle for the car to make circular motion in the absence of friction. In the absence of any static friction, therefore, the car's acceleration points towards the centre of the banked curve. However, in this case the car's acceleration still has a downward component along the slope. My understanding of the direction of static friction means therefore, when it is added in, it should act up the slope. But in reality no static friction is produced in such a case.   Can someone explain what is wrong with my method of finding the direction of friction? Or if there is nothing wrong, how have I misapplied it in this case to create this paradox?