In Python, how do you reference a variable inside another function, or how do you make a local variable global? Here's my code: http://pastie.org/1849782 I'm attempting to find the first 1000 prime numbers.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I'm a bit busy at the moment, but will be able to help you out soon if you're still stuck.
You can always reference a global variable within a function, but to change it, you have to do
at the top of you function def
a = 1
a += 1
I'll be on in a little while, let me know if you're still stuck on it.
P.S. You don't need to assign to `a` before the def, just before you call it.
a += 1
a = 1
I'm not sure you want to nest function definitions like that. Also, if `odd` is a tuple, you can't mutate it.
Try having a look through this, it find's the 1000th prime, but doesn't keep a list of all one thousand. You could easily get it to do that. Let me know if you're still stuck.