On 3 August 2013 02:44, <kevin4f...@gmail.com> wrote: > Yeah, I already know about that. But if I try to change it, I'm not even > able to start the program. If I try to change the if statement that it > corresponds with, I get a an error saying "card" is not a global. And if I > try to shift it in, for some reason...the program runs through the MISS > line multiple times. >
You have a car with a broken engine and a broken tire and are telling us that you refuse to fix the engine because it highlights the problem of the broken tire. Take the fix and move on to the next problem. One piece of advice is about scoping. This is perhaps the hardest "gotcha" of Python conceptually, but it's sensible once you understand the justifications. Run the four commands below and try and understand why this applies to your code. a = 1 def access_global(): print(a) def set_variable(): a = 2 print(a) def broken_set(): a = a + 1 print(a) def also_broken(): print(a) return a = 1 # Never run! The fix for the broken variants is to start the functions with "global a".
-- http://mail.python.org/mailman/listinfo/python-list