I have this chunk of code I'm trying to get to work and I need to use the 'password' variable in both of the if statements but I continue to get &quot;NameError: name 'password' is not defined&quot; (I'm fairly new to coding) I know there's probably a lot of ways I could improve this written in python 3.8 by the way option = str(input(&quot;do you want a new password? y/n: &quot;)) if option in ['y', 'Y']: def generatepassword():     digit = int(input(&quot;How long do you want the password? (integer only)&quot;))     for i in range(digit):         char = random.choice(string.ascii_letters+string.digits+string.punctuation)         (password) = char         print(password) generatepassword()  if option in ['n', 'N']: password = str(input(&quot;Password: &quot;))  final = str(input(&quot;Is this information correct?: &quot;))  if final in ['y', 'Y']: f = open(&quot;passwords.txt&quot;, &quot;a&quot;) f.write (password) f.write ('\n') f.close f = open(&quot;email.txt&quot;, &quot;a&quot;) f.write(email) f.write('\n') f.close f = open(&quot;web.txt&quot;, &quot;a&quot;) f.write(website) f.write('\n') f.close
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.
How to reverse the direction of the y axes The problem from Burton: show that the equation $n^2 + (n+1)^2 = m^3$ has no solution in the positive integers.  So far, I can see that gcd($n$,$n+1$)$=1$ and $m \equiv_4 1$ and $m=a^2 + b^2$ for some integers a,b. I'm guessing I need to reach a contradiction.  At this point, I am stuck. Any hints? Proving that the given set has at most $2^{n-1}$ elements Missing processing menu in QGIS? I'm sure there is a really simple explanation to this but haven't found any pointers on this forum or elsewhere. I seem to have lost the 'processing' menu from QGIS and can't figure out how/why!? Any ideas what I might have done to make this happen?  I'm running QGIS 2.8 built against GDAL 1.10 on Ubuntu 14.04. I want to get a 360 and don't know wether to get the bigger (250GB), newer, more expensive Elite, or get one of the older, smaller (120GB), last gen ones. I know the arcade is going to be too small to save anything useful  How much hard disk space is recommend? What else is stored besides games? What's the simplest way to decrement a date in Javascript by 1 day? I need to decrement a Javascript date by 1 day, so that it rolls back across months/years correctly.  That is, if I have a date of 'Today', I want to get the date for 'Yesterday'.  It always seems to take more code than necessary when I do this, so I'm wondering if there's any simpler way.    What's the simplest way of doing this?  [Edit: Just to avoid confusion in an answer below, this is a JavaScript question, not a Java one.] I'm rewiring a a small part of a wall and I'm confused about a combination of the NEC and the products that I'm able to find.  I'm working on a 20 amp circuit (with 12g wire of course).  I'm connecting 4 receptacles each in their own box, 15 amp receptacles for normalcy.  But the terminals don't seem to accept 12g wire, even on the screws.  My first reaction was to make pigtails 14g pigtails, so that the 14g tap goes directly to the receptacle and is not used to feed the rest of the circuit.  12g in the box, 12g out of the box, and 14g inside the box only.    Is that type of splice allowed, or should I look harder for a 15 amp outlet that can more easily accept 12g wire? Here's an example of a short conversation between me and a native speaker via text messages:  A: I'm so exited for this app B: Yeah, me too A: We start tomorrow B: OK   Shouldn't it be "We are starting tomorrow"?! Rotate (group) objects outwards on spherical particle system? I'm trying to create a mini-world with (among other things) trees on it. I have created an icosphere, modeled several trees and put them in a group. Next I added a particle system to the sphere, and chose hair. In the "render" section I selected Group and the name of the group I created. As expected the trees show up but they're all oriented in the same direction, while I would like them to pop up just like the default hairs do (along the normal of the individual faces). I tried fiddling with all kinds of settings, had them oriented in all kind of ways (e.g. towards the "north pole"). I also tried using the emitter instead of hair setting but without success as well. I wanted to show that $X' / U^\perp \cong U'$, for $U$ being a closed subspace of the Banach space $X$.  Therefore I looked at $l: X' / U^\perp \cong U' , x' + U^\perp=[x']  \mapsto x'|_U$.  It is clear that this map is onto, as we just take a $u' \in U'$. Then I can use Hahn-Banach to get an appropriate $x'$ such that $x'|_U = u'$ and in particular $||x'||=||u'||$.  Now I need to show that is isometric: since we always have $\|[x']\|\le \|x'\|$ and by Hahn-Banach we have $\|x'\|=\|x'_{|U}\|$, this shows $\|[x′]\|\le \|x'_{|D}\|$ and it should be always true that $\forall y' \in U^\perp: \|x'-y'\| \ge \|x'_{|D}\|$, hence $\|[x']\|\ge \|x'_{|D}\|$. Is this reasoning correct? The isometric property follows. I have a High poly mesh and I have decided to make the low poly by merging as it is easiest for me. Would it be possible to change the W Hotkey , so that it merges to the center automatically? It is time consuming pressing W > Merge > Center. Star vs Heart icon to represent save as a favourite I am working on a mobile app that involves the user saving a favourite location. I wanted to use an icon to represent that feature, but I'm not sure which one is better – a star or a heart icon.  Some say heart icon tends to increase the rate of productivity, and some say they are used to a star icon to 'save' or 'bookmark' something.  What do go you guys think? Boolean expression (grammar) parser in c++ How to know if Google Sheets IMPORTDATA, IMPORTFEED, IMPORTHTML or IMPORTXML functions are able to get data from a resource hosted on a website? Google Sheets has several import functions   IMPORTDATA IMPORTFEED IMPORTHTML IMPORTXML   Sometimes the above functions returns errors like #N/A Imported content is empty and would like to be sure that there isn't a problem with the resource content to be imported.  How do I know if these functions are able to get the content that I looking to import?  I know that there also exist IMPORTRANGE but that function only is able to import content from Google Sheets spreadsheets How can I set the value of auto property backing fields in a struct constructor? Given a struct like this:  public struct SomeStruct {     public SomeStruct(String stringProperty, Int32 intProperty)     {         this.StringProperty = stringProperty;         this.IntProperty = intProperty;     }      public String StringProperty { get; set; }     public Int32 IntProperty { get; set; } }   Of course, a compiler error is generated that reads The 'this' object cannot be used before all of its fields are assigned to.  Is there a way to assign values to the backing fields or the properties themselves, or do I have to implement properties the old-fashioned way with my own explicit backing fields? Can I insert elements to the beginning of an element using .appendChild()? If the user selects an option in a dropdown box, there must be added a label and a textbox. Using appendChild, these elements get added to the end of the container.  var newFreeformLabel = document.createElement('label'); newFreeformLabel.innerHTML = 'Omschrijving:';  var newFreeformField = document.createElement('input'); newFreeformField.className = 'textfield'; newFreeformField.name = 'factuur_orderregel[]';  var newFreeformSpacer = document.createElement('div'); newFreeformSpacer.className = 'spacer';  container.appendChild(newFreeformLabel); container.appendChild(newFreeformField); container.appendChild(newFreeformSpacer);   The issue is that these elements should be inserted at the beginning of container, not at the end.  Is there a solution to this in PrototypeJS? What is wrong with this fake proof $e^i = 1$? $$e^{i} = e^{i2\pi/2\pi} = (e^{2\pi i})^{1/(2\pi)} = 1^{1/(2\pi )} = 1$$  Obviously, one of my algebraic manipulations is not valid. Several companies are commercializing tests for telomere length such as this one . I understand the basic mechanism for why telomeres shorten during DNA replication, but how good is the evidence that telomere length is a reliable indicator of healthspan/lifespan? I am confused with the definition of non-parametric model after reading this link  and .   Originally I thought "parametric vs non-parametric" means if we have distribution assumptions on the model (similar to parametric or non-parametric hypothesis testing). But both of the resources claim "parametric vs non-parametric" can be determined by if number of parameters in the model is depending on number of rows in the data matrix.  For kernel density estimation (non-parametric) such a definition can be applied. But under this definition how can a neural network be a non-parametric model, as the number of parameters in the model is depending on the neural network structure and not on the number of rows in the data matrix?  What exactly is the difference between parametric and a non-parametric model? Explaining two-tailed tests I am looking for various ways of explaining to my students (in an elementary statistics course) what is a two tailed test, and how its P value is calculated.  How do you explain to your students the two- vs one- tailed test?