Why are objects allowed to be used after a block? In this code, why do a and b not get destroyed at the ends of their respective blocks?  flag = True if flag:     a = 1  for i in range(2):     b = 2  print(a, b)   Instead, this code prints 1 2. Why does Python allow this? When can I rely on this behavior?
Short description of the scoping rules? What exactly are the Python scoping rules?  If I have some code:  code1 class Foo:    code2    def spam.....       code3       for code4..:        code5        x()   Where is x found?  Some possible choices include the list below:   In the enclosing source file In the class namespace In the function definition In the for loop index variable Inside the for loop   Also there is the context during execution, when the function spam is passed somewhere else. And maybe  pass a bit differently?  There must be a simple reference or algorithm somewhere.  It's a confusing world for intermediate Python programmers.
From the limit definition of differentiability, determine where the function $f(x) = \sqrt{x}$ is differentiable? For the function $f(x) = \sqrt{x}, \hspace{2 mm} f: [0, \infty) \rightarrow \mathbb{R}$, I wish to find all points $a$ at which $f(x)$ is differentiable, from the definition $$ f'(x) = \lim_{x \rightarrow a}\frac{f(x)-f(a)}{x-a} $$  Clearly, for our function $f(x) = \sqrt{x}$, this gives us $$ f'(x) = \lim_{x\to a}\frac{\sqrt{x} - \sqrt{a}}{x-a} $$  So the question boils down to showing for what values of $a$ this limit exists. How would this be done? Intuitively, I know that the answer is that the limit exists for all $a \in [0, \infty)$ and is given by $\frac{1}{2 \sqrt{a}}$, but I'm unsure of how to prove this from the limit definition of differentiability. I want to copy/modify/delete a Minecraft world. Where can I find my saves folder? crisscross, dillydally, riffraff, etc Some English words only differ in their vowels: crisscross, dillydally, riffraff, etc. Is there a name for them? Inheritance in Java - creating an object of the subclass invokes also the constructor of the superclass. Why exactly? I have a question about inheritance in Java.  I have two classes A and B , and class B, inherits from A:  public class A {      public A() {          System.out.println("Hi!");      } }   public class B extends A {      public B() {          System.out.println("Bye!");      }       public static void main(String[] args) {          B b = new B();      } }   When I run program B, the output is:  Hi! Bye!      Question : why the constructor of class A is invoked, when I create and object of class B ?    I know that B inherits everything from A - all instance or class variables, and all methods, and in this sense an object of B has all characteristics of A plus some other characteristics defined in B. However, I didn't know and didn't imagine that when I create an object of type B, the constructor of A is also invoked. So, writing this:  B b = new B();   creates Two objects - one of type B, and one of type A.  This is getting interesting,   can somebody explain why exactly this happens? How to have a figure with caption in multicol environment? I am having the following problem with adding a figure inside the multicol environment:  \documentclass[10pt, twoside]{book} \usepackage{graphicx} \usepackage{subfig}  \begin{document}   \begin{multicols}{2}  a test file for picture inclusion along with the captions and labeling \begin{figure}  \centering  \includegraphics[width=5cma]{Cauchy_sequence_illustration-png}\\  \caption{Lets see}\label{pinki} \end{figure} \end{multicols}  \begin{figure}  \centering   \includegraphics[width=5cm]{Cauchy_sequence_illustration-png}\\  \caption{Lets see}\label{pinki} \end{figure}    \end{document}    After this while I am pressing Ctrl + Shift + X (usually I compile like this in DVI format and then clicking "dvi--->pdf" I convert it into PDF document.) the picture in multicol environment is not shown in YAP Viewer but the second one (which is outside of multicol environment) is shown along with the caption.  Kindly help me how to handle this problem. Please note that I am using the figure in .ps format. And I am not allowed to use any other format according to the instruction. When is $\phi(n)$ a prime number? I was thinking about this problem today. If $p$ divides $n$, then $p-1$ must divide $\phi(n)$. But $p-1$ is even for all primes greater than $2$, so must $\phi(n) = 2$ - the only even prime? I feel like this argument is shaky and not very rigorous! How can I get TeXstudio's syntax highlighting to recognize an unknown command? TeXstudio does not recognize the LaTeX command \rm (red highlighting in the document, with the message: unrecognized command), even after I activate all possible completion files (.cwl).  In such a case, what can I do so that TeXstudio recognizes a certain command for highlighting? Does voltage drop occur with zero load and zero resistance I'm working with some code that widely uses the idiom of returning a pointer to a static local variable.  eg:  char* const GetString() {   static char sTest[5];   strcpy(sTest, "Test");   return sTest; }   Am I right in thinking that this is safe?  PS, I know that this would be a better way of doing the same thing:  char* const GetString() {   return "Test"; }   Edit: Apologies, the function signature should of course be:  const char* GetString(); Can I boot memtest86+ if I'm using UEFI? Downloaded the Ubuntu 16.04.2 .iso install disk and flashed it onto a USB stick.  Booting on the USB stick, there is no memtest86+ option (along with "Try Ubuntu").  Is there a way to add it to the install options?  (it's for a UEFI boot PC running normally Windows, its owner does not want to install Ubuntu. "memtest86+" is completely free (unlike "memtest86"), but is quite old, and does not offer a UEFI boot - this is why having it within the Ubuntu options makes things easier) How to suppress Terminated message after killing in bash? How can you suppress the Terminated message that comes up after you kill a process in a bash script?  I tried set +bm, but that doesn't work.  I know another solution involves calling exec 2&gt; /dev/null, but is that reliable? How do I reset it back so that I can continue to see stderr? What is the best collation to use for MySQL with PHP? I'm wondering if there is a "best" choice for collation in MySQL for a general website where you aren't 100% sure of what will be entered? I understand that all the encodings should be the same, such as MySQL, Apache, the HTML and anything inside PHP.  In the past I have set PHP to output in "UTF-8", but which collation does this match in MySQL? I'm thinking it's one of the UTF-8 ones, but I have used utf8_unicode_ci, utf8_general_ci, and utf8_bin before. How does reputation between the main site and its meta work on SE 2.0? I noticed that the reputation from the main site carried over to meta on Gaming (at least the first upvote), I guess that doesn't work the other way around, right?  Is it then impossible to have a meta reputation higher than the site reputation? Is it ethical to use a textbook required for a class that was easily found online? How to copy text out of a PDF without losing formatting? .fbx export why there are no materials or textures? Let $N = \{N(t) \}_{t\geq 0 }$ be a Poisson process. I already know that $N(t)- \lambda t$ is a martingale where $\mathbb{E} [ N(t) ] = \lambda t$.   I want to prove that $$ \frac{N(t)}{t} \rightarrow \lambda, \quad t \rightarrow \infty \quad \text{ a.s.}. $$  To prove this I received a hint that I should use the martingale law of large numbers which states that:  Theorem: (Martingale LLN)  Let $S= (S_n = \sum_{k=1}^n X_k)_{n=1,2,\ldots}$ be a martingale with respect to the filtration $(\mathcal{F}_n)_{n=1,2,\ldots}$. Then $\sum_{k=1}^n X_k/k$ converges almost surely on the set $\left\{ \sum_{k=1}^\infty k^{-2} \mathbb{E}\left[ X_k^2 \mid \mathcal{F}_{k-1} \right] &lt; \infty \right\}$. Hence $S_n/n \rightarrow 0$ a.s. on the same set.  Now to use this theorem I think I need to use Doob-Meyer to decompose $N(t)$ as the sum of a martingale and an increasing process. Which would be the martingale $M(t) = N(t) - \lambda t$ and increasing process $A(t) = \lambda t$. But how is $M(t)$ the sum of a martingale? And I do not know how this exactly relates to the thing I have to prove. Thanks for any help. I improved an edit... but did I actually? how to prove the chain rule? I have just learnt about the chain rule but my book doesn't mention a proof on it. I tried to write a proof myself but can't write it. So can someone please tell me about the proof for the chain rule in elementary terms because I have just started learning calculus. Equipartition of energy Let $u$ solve the initial-value problem or the wave equation in one dimension: $$\begin{cases}u_{tt}-u_{xx}=0 &amp; \text{in } \mathbb{R} \times (0,\infty) \\ u = g, u_t = h &amp; \text{on } \mathbb{R} \times \{t=0\}. \end{cases}$$ Suppose $g,h$ have compact support. The kinetic energy is $k(t) := \frac 12 \int_{-\infty}^\infty u_t^2(x,t) \, dx$ and the potential energy is $p(t) := \frac 12 \int_{-\infty}^\infty u_x^2(x,t) \, dx$. Prove (a) $k(t)+p(t)$ is constant in $t$, (b) $k(t)=p(t)$ for all large enough times $t$.  This is Chapter 2, Exercise 24 of PDE Evans, 2nd edition. I am only doing part (a) right now; my work is shown below: Define $$e(t):=k(t)+p(t)=\int_{-\infty}^\infty u_t^2+u_x^2 \, dx.$$ Then $$e'(t)=\frac 12 \int_{-\infty}^\infty 2u_tu_{tt}+2u_{x}u_{xt} \, dx= \int_{-\infty}^\infty u_tu_{tt}+u_{x}u_{xt} \, dx.$$ Now, I want to get $e'(t)=0$ so that $e(t)$ is constant. How can I go about doing this? I do know that I can use $u_{tt}-u_{xx}=0$, if $t &gt; 0$. With $t&gt;0$ into mind, do I have to consider the $t=0$ case separately? Or can I treat both cases together as $t \ge 0$, since $g$ and $h$ have compact support?