Python: Code is ignoring the if and else

Chris Angelico rosuav at gmail.com
Fri Aug 2 21:56:26 EDT 2013


On Sat, Aug 3, 2013 at 2:44 AM,  <kevin4fong at 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.

Okay. Stop, take a step back, and simplify your problems. You're
currently exhibiting a technique of shotgun programming that may be
getting in your way; you're just trying things without really knowing
what you're doing. Play with individual control structures in
interactive Python (eg IDLE), and get to know what's really happening.
Read the docs. Be sure you're structuring your code the way you think
you are. You'll find everything easier once you understand why your
code is doing what it's doing.

ChrisA



More information about the Python-list mailing list