Else statement executing when it shouldnt

Roy Smith roy at panix.com
Mon Jan 21 05:47:25 CET 2013

In article <2cc6791f-ba56-406c-a5b0-b23023caf4bb at googlegroups.com>,
 eli m <techgeek201 at gmail.com> wrote:

> an else statement is running when it shouldnt be. It is on the last line. 
> Whenever i am in the math or game function, when i type in main, it goes back 
> to the start of the program, but it also says not a valid function. I am 
> stumped!
> Here is my code:

[many lines of code elided]

TL;DNR :-)

A basic debugging technique is to try to find the minimum amount of code 
that can reproduce the problem.

Find some hunk of lines that you're pretty sure can't be at fault, and 
delete them.  See if you can still reproduce the problem.  Assuming you 
can, delete another hunk of code.  Keep going until you're down to the 
smallest possible amount of code which demonstrates the problem.

There's a couple of good things that come out of this.  One is that it's 
likely that in the course of doing this, you'll figure out what's wrong.  
The other is that if you can't figure it out, at least now you'll have 
something that's easy to show somebody else when you ask for help.

More information about the Python-list mailing list