Python’s for statement iterates over the items of any sequence (a list or a string).  But where does the sequence come from in below code?  file=open('filename.txt','r') for line in file:     print line   Is this related to the __iter__() method?  Just some quote:       An object capable of returning its members one at a time. Examples of iterables include all sequence types (such as list, str, and tuple) and some non-sequence types like dict, file objects, and objects of any classes you define with an __iter__() or __getitem__() method. Iterables can be used in a for loop and in many other places where a sequence is needed (zip(), map(), ...). When an iterable object is passed as an argument to the built-in function iter(), it returns an iterator for the object. This iterator is good for one pass over the set of values. When using iterables, it is usually not necessary to call iter() or deal with iterator objects yourself. The for statement does that automatically for you, creating a temporary unnamed variable to hold the iterator for the duration of the loop. See also iterator, sequence, and generator.
How would one create an iterative function (or iterator object) in python?
I have to compute this integral $$\int_{0}^{\infty} \frac{dt}{1+t^4}$$ to solve a problem in a homework. I have tried in many ways, but I'm stuck. A search in the web reveals me that it can be do it by methods of complex analysis. But I have not taken this course yet. Thanks for any help. Getting an "Authentication token manipulation" error when trying to change my user password I am logging in to my Ubuntu Server using my username. Once I am logged in I am typing passwd command. Entering a new password but a second after getting following error messages:  passwd: Authentication token manipulation error passwd: password unchanged   What is wrong here? How can I change my password otherwise if I don't have access to that server physically, i.e. I am connecting remotely with ssh using terminal. Show that the integral of a positive function is positive How do I rip audio from a DVD? Vec2 a, b; // some random vector Vec2 cross = a.Cross(b); RelativeDirection(a,b,cross); // return true if the direction of                               // rotating a to b is counter-clockwise   How do I implement the function RelativeDirection()?  I got some suedo code from the textbook:  if a.Cross(b) &gt; 0 then ... else ...   but the cross product is a vector right? how do you compare it with an integer? Difference between 'struct' and 'typedef struct' in C++? macOS Mojave won't install updates past 10.14.1 due to requirement for APFS formatting I have a MBP 2012 I upgraded from High Sierra to Mojave after it came out as GA. I don't recall if I was asked about upgrading to APFS when Id id that, but at this time the main volume is Mac OS Extended (Journaled).  My current About This Mac...version is Mojave 10.14.1 (18B75). Now, when updates are advertised from the App Store, I'm unable to upgrade because 10.14.3 is required.  No OS updates show in the App Store, and when I searched for the updaters (10.14.2 Combo, etc), I can't install because the installer reports "macOS 10.14.2 Update can't be installed on this disk. This Mac can only install macOS on APFS-formatted drives."  I tried the search results recommending to boot in Recovery Mode and use Disk Utility, but APFS is not available as a type.  I have good backups and I can reformat the boot volume if I need to, but I have not done this before. Should I get a 10.14.3 installer to do this and boot from an external drive? The only guies and message boards I've found just keep saying to install 10.14.3 (I can't) or convert the disk in Recovery Mode (APFS is not available as an option.)  Any known-good ways to get my 10.14.1 upgraded so I can keep getting App Store updates? antonym for beneficiary Let $p$ be a prime number. If -1 is a square in $\mathbf F_p$, it means that there exists an element of order 4. So $p-1$ is divisible by 4 and therefore $p \equiv 1$ (mod 4). I wonder the converse is also true. Does $p \equiv 1$ (mod 4) mean the existence of an element whose square is $-1$ in $\mathbf F_p$? There is a problem 3.3 in :     Ambiguities in the energy-momentum tensor:      (a) If you add a total derivative to Lagrangian ${\cal{L}} \rightarrow {\cal{L}} + \partial_\mu X^\mu$, how does the energy-momentum tensor change?      (b) Show that the total energy $Q = \int d^3x \; {\cal{T^{00}}}$ is invariant under such changes   Given the definition of energy-momentum tensor:  $$ {\cal{T}}^\mu{}_\nu = \sum_n \frac{\partial{\cal{L}}}{\partial \left( \partial_\mu \phi_n \right)} \partial_\nu \phi_n - g_{\mu\nu} {\cal{L}} $$  It changes as:  $$ \delta {\cal{T}}^\mu{}_\nu =  \sum_n \left( \partial_\rho \frac{\partial{X^\rho}}{\partial \left( \partial_\mu \phi_n \right)} \right) \partial_\nu \phi_n - g_{\mu\nu} {\partial_\rho X^\rho} $$  $T^{00}$ changes as:  $$ \delta {\cal{T}}^{00}= \sum_n \left( \partial_\rho \frac{\partial{X^\rho}}{\partial \dot{\phi_n}} \right) \dot{\phi_n} - \partial_\rho X^\rho $$   From this point I’m stuck. The first term doesn’t seem to disappear at all after integration over space, and the second disappears only partially:  $$ \int d^3x \; \dot{X^0} $$  So even if I’d have assumed that $X$ depends on position, and not on the fields - the total energy doesn’t seem to be invariant under it.  What is the best way to proceed forward with this? How do I get a selected vertex and it's corresponding uv vertex?  A vertex I can get with  bpy.context.active_object.data.vertices[0]   A uv vertex I can get with  bpy.context.active_object.data.uv_layers['UVMap'].data[0]   But the index is not the same for uv and mesh vertex. Checking if a worksheet-based checkbox is checked Limit with inverse trignometry We have to find the value of $$\lim_{n\to \infty}\sum_{k=2}^n\arccos\left(\frac{1+\sqrt{(k-1)k(k+1)(k+2)}}{k(k+1)}\right)$$  I tried it a lot but could not find any start.   Please help me in this . What does each SPECIAL stat in Fallout Shelter do? Besides its workplace uses, like Charisma in Living Quarters, Strength in Power Generators, Agility in Diners.   Do we know if Endurance increases HP in the Dwellers, or that strength helps in melee damage / survivability in the wastelands? And Perception? set of almost complex structures on $\mathbb R^4$ as two disjoint spheres The set of almost complex structures on $\mathbb R^{2n}$ is given by $$ M_n = \frac{GL(2n,\mathbb R)}{GL(n,\mathbb C)} = \mathcal C_+ \sqcup \mathcal C_-,$$ taking into account that $\det = \pm 1$ gives two disjoint sets.  How do we show that $M_2=S^2 \sqcup S^2$? Moreover, I'm a bit confused by dimensions: how does $\dim_{\mathbb R}M_2=8$ relates with the latter decomposition?  This is exercise 1.2.1 from the book Complex geometry by Huybrechts. I want to switch to French locale. So I tried the below command:  myUbundu@myUbundu-desktop:~$ export LC_ALL=fr_FR   But I am getting the warning  -bash: warning: setlocale: LC_ALL: cannot change locale (fr_FR)   How to set the locale to French? Do I need to install additional packages? How does Windows know whether it has internet access or if a Wi-Fi connection requires in-browser authentication? In Windows 7, the notification area networking icon will show an error indicator if there is no internet access , and the error icon goes away once there is a successful connection to the internet . Sometimes, if the WiFi connection requires an in-browser authentication step, like on many guest networks in hotels or universities, then the following pop-up bubble appears, saying as much:    How does Windows know whether or not it has a successful internet connection? Presumably it is checking some online Microsoft service to see whether it has a successful connection, gets redirected to some other page, or doesn't get any response at all, but I haven't seen anywhere that this process or the services used are documented. Can anybody explain how this works? I would prefer answers that refer to facts, rather than just guessing, but if you have a really good guess, then go for it.     This question was a .   Read the May 16th, 2011  for more details or  Question of the Week. iPhone screen randomly turns on Using differentiation for computing $\int_{0}^{1}\frac{\arctan(ax)}{x\sqrt{1-x^2}}\,dx$ How can I prove that I can differentiate the integral:  $$ \int_{0}^{1} \frac{\arctan(ax)}{x\sqrt{1-x^2}}\,dx $$  First I have to prove this integral converges. Next I have to prove the integral $$ \int_{0}^{1} f_{a}'(x, a)\,dx $$ converges uniformly.  Then I can differentiate integral with Leibniz's rule.  I tried Weierstrass and Dirichlet's tests. Nothing succeeded.   Thank you for help in advance. Why is the QGIS map composer grid showing unreasonable lat/lon? I need to print a map with coordinates in the format of Degree, Minute and second. CRS is set to WGS 84 (EPSG 3857) for both layers and on the project properties it is set to enable transformation on the fly. But then, when in map composer I get the following coordinates, which make no sense to me.