Else statement executing when it shouldnt
eli m
techgeek201 at gmail.com
Sun Jan 20 23:55:29 EST 2013
On Sunday, January 20, 2013 8:52:12 PM UTC-8, Chris Angelico wrote:
> On Mon, Jan 21, 2013 at 3:40 PM, 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!
>
>
>
> Check your indentation levels. I see a few things here that look odd:
>
>
>
> > if function == "help":
>
> > while helpfunc == 0:
>
> > if helpmain == "main":
>
> > else:
>
>
>
> What is the else meant to bind to? The innermost if? The 'if function
>
> == "help"'? It's currently binding to the while.
>
>
>
> Recommendation: Break this up! Your main loop is huge! It's way too
>
> easy to get lost in it. And while you're at it, consider unifying some
>
> of the similar blocks of code. The solution to both issues is simple:
>
> Use functions. Have you been taught about them yet?
>
>
>
> Also, side tip: Be honest about homework. I'm fairly sure that's what
>
> this is. :)
>
>
>
> ChrisA
Its not homework. It is a personal project.
More information about the Python-list
mailing list